title: Unit Testing Lambda Expressions
body: <p>I have a method that is shown as below and this in turn call multiple private methods, that I won't be posting here.</p>
  
  <pre><code>@Bean
      public CommandLineRunner registerStartersAndReaders(final Vertx vertx, final SpringVerticleFactory springVerticleFactory,
                                                          final SpringUtil springUtil, final GslConfig gslConfig) {
          return args -&gt; {
              // Scan all the beans annotated with the @ElasticsearchBatchDataListener annotation.
              List&lt;Pair&lt;Object, Method&gt;&gt; listenerMethods = springUtil.getListenerMethods();
  
              // Deploy the starters per listener.
              deployVerticle(listenerMethods, jsonConfig -&gt; deployStarterVerticle(vertx, springVerticleFactory, jsonConfig), config);
  
              // Deploy the reader verticles.
              deployVerticle(listenerMethods, jsonConfig -&gt; deployReaderVerticle(vertx, springVerticleFactory, jsonConfig), config);
              setupTriggers(vertx, listenerMethods, config);
          };
      }
  </code></pre>
  
  <p>Then I have a test method for it :</p>
  
  <pre><code>@Test
      public void registerStartersAndReadersTest() {
          when(springUtil.getListenerMethods()).thenReturn(value);
          CommandLineRunner runner = config.registerStartersAndReaders(vertx, springVerticleFactory, springUtil, config);
          assertNotNull(runner);
      }
  </code></pre>
  
  <p>Here, all the parameters passed into the method call are mocks. The problem is, when I run this test, it passes but it returns the value without getting into the private methods as it just returns 'args'. </p>
  
  <p>Can someone please guide me, as to how I can make my test cover all the possible code. I am not supposed to change my code for the test.</p>