title: Test Observable.FlatMap Mockito
body: <p>I've been looking on internet but haven't found the solution if any (new on UnitTest and Mockito)</p>
  
  <p>It's possible to test a method that return a call of a service and manipulate it's result before to return it? Example;</p>
  
  <pre><code>public Observable&lt;Reports&gt; getUserReports(Integer userId) {
      return serviceClient
          .getReports(userId)
          .flatMap(serviceReports -&gt; {
              System.out.println("Testing inside flatMap"); &lt;- never reach this line therefore duno if methods down here are invoked and work perfectly
              final Observable&lt;List&lt;Report&gt;&gt; reports = getPendingReports(userId, serviceReports);
  
              //More methods that modify/update information
  
              return zip(observable1, observable2, observable3
                  (report1, report2, report3) -&gt; {
                      updateReports(otherArguments, report1, report2, report3);
                      return serviceReports;
                  });
  
          });
  }
  </code></pre>
  
  <p>So far I've tried;</p>
  
  <pre><code>@Test
  public void myTest(){
          when(serviceClient
              .getReports(anyInt()))
              .thenReturn(Observable.just(reports));
  
          Observable&lt;Reports&gt; result = mocketClass.getUserReports(userId)
  }
  </code></pre>
  
  <p>Tryed with Spy and Mock but no luck so far. Any hint or help would be great.</p>