Skip to content

Commit

Permalink
fix issues with unit-tests
Browse files Browse the repository at this point in the history
fix the issues that arose from removing DEFAULT_TARGET_LOCALE
unit tests will need a light overhaul to be fully useful again
  • Loading branch information
Vogel612 committed Dec 3, 2016
1 parent 454562a commit b577032
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,10 @@ public void tableContainsItemsFromBuilding() {
public void onParseCompletion_rebuildsView() {
List<Translation> rootList = Collections.singletonList(new Translation("", "", ""));
doReturn(rootList).when(filesetOverviewModel).getTranslations(FALLBACK_LOCALE);
List<Translation> targetList = Collections.singletonList(new Translation("", "", ""));
doReturn(targetList).when(filesetOverviewModel).getTranslations("de");

cut.onParseCompletion();

verify(filesetOverviewModel).getTranslations(FALLBACK_LOCALE);
verify(filesetOverviewModel).getTranslations("de");
verify(filesetOverviewModel, times(2)).getTranslations(FALLBACK_LOCALE);
verifyNoMoreInteractions(filesetOverviewModel, translationView, localeChooser, dialog);
}

Expand All @@ -123,14 +120,11 @@ public void onTranslateRequest_delegatesToTranslationPresenter() {
final String key = "Key";
Translation fakeRoot = mock(Translation.class);
doReturn(fakeRoot).when(filesetOverviewModel).getSingleTranslation(FALLBACK_LOCALE, key);
Translation fakeTarget = mock(Translation.class);
doReturn(fakeTarget).when(filesetOverviewModel).getSingleTranslation("de", key);

cut.onTranslateRequest(key);

verify(filesetOverviewModel).getSingleTranslation(FALLBACK_LOCALE, key);
verify(filesetOverviewModel).getSingleTranslation("de", key);
verify(translationView).setRequestedTranslation(fakeRoot, fakeTarget);
verify(filesetOverviewModel, times(2)).getSingleTranslation(FALLBACK_LOCALE, key);
verify(translationView).setRequestedTranslation(fakeRoot, fakeRoot);
verify(translationView).show();
verifyNoMoreInteractions(filesetOverviewModel, translationView, localeChooser, dialog);
}
Expand All @@ -146,8 +140,7 @@ public void onTranslationSubmit_hidesTranslationView_propagatesEdit_updatesView(
cut.onTranslationSubmit(t);

verify(filesetOverviewModel).updateTranslation("de", "Key", "Translation");
verify(filesetOverviewModel).getTranslations("de");
verify(filesetOverviewModel).getTranslations(FALLBACK_LOCALE);
verify(filesetOverviewModel, times(2)).getTranslations(FALLBACK_LOCALE);
verify(translationView).hide();
verifyNoMoreInteractions(filesetOverviewModel, translationView, localeChooser, dialog);
}
Expand Down

0 comments on commit b577032

Please sign in to comment.