### Question:
TranslationService { Maybe<TranslationResult> getOnlineTranslation(String question, String langFrom, String langTo) { if (appState.isOfflineMode) { return Maybe.empty(); } return seznamRetrofit.create(SeznamRestInterface.class) .doTranslate(langFrom + "_" + langTo, question) .flatMap(response -> parseTranslationJson(response, question, langFrom, langTo)) .firstElement(); } TranslationService(final DatabaseManager databaseManager,
                              final AppState appState,
                              final Retrofit seznamRetrofit,
                              final Retrofit seznamSuggestRetrofit,
                              final NetworkService networkService,
                              final PublishSubject<Action> executeActionSubject); Maybe<List<String>> getSuggestions(String template, String langFrom, String langTo, int limit); Maybe<TranslationResult> translate(String question, String langFrom, String langTo);  }### Answer:
@Test public void testOnlineTranslation1() { TranslationResult translationResult = translationService.getOnlineTranslation("pas", "cz", "ru") .blockingGet(); assertEquals(3, translationResult.getTranslations().size()); assertEquals("pas", translationResult.getWord()); }
@Test public void testOnlineTranslation2() { final String[] A_TRANSLATIONS = new String[]{"и","да", "уж", "плюс", "плюс", "да", "и да́же", "а", "но", "да", "a to, a sice а и́менно", "да", "и (поэ́тому)", "и потому́", "а", "и"}; TranslationResult translationResult = translationService.getOnlineTranslation("a", "cz", "ru") .blockingGet(); assertEquals(A_TRANSLATIONS.length, translationResult.getTranslations().size()); assertEquals("a", translationResult.getWord()); for (int i=0; i<translationResult.getTranslations().size(); i++) { assertEquals(A_TRANSLATIONS[i], translationResult.getTranslations().get(i)); } }