RestFlashcardsModule implements FlashcardsModule { @Override public Call<FlashcardTestData> getFlashcards() { logger.debug("getFlashcards() called"); return service.getFlashcardData(FLASHCARDS_COUNT, true, System.currentTimeMillis()) .map(FlashcardResponseModel::toTestData); } @Inject  RestFlashcardsModule(RestService service); @Override Call<FlashcardTestData> getFlashcards(); @Override void postResult(FlashcardTestResult result);  }
@Test public void getFlashcards() { FlashcardResponseModel model = mock(FlashcardResponseModel.class); FlashcardTestData mockData = FlashcardTestData.create("ui", "learn", Collections.emptyList()); when(model.toTestData()).thenReturn(mockData); when(service.getFlashcardData(anyInt(), anyBoolean(), anyLong())).thenReturn(Call.just(model)); TestAction<FlashcardTestData> action = new TestAction<>(); module.getFlashcards().enqueue(action, Actions.empty()); action.assertValue(mockData); }