@Test public void testGetOtherText() { TranslateableText text = mock(TranslateableText.class); modelElementDisplayController.setLang("it"); when(text.getTextIt()).thenReturn("text_it"); when(modelElementDisplayController.imageUrlUtil.adaptImageUrls( eq("text_it"), anyString(), eq("it"))) .thenReturn("adapted_text_it"); Assert.assertEquals("adapted_text_it", modelElementDisplayController.getOtherText(text)); }
@Override public String getLocalizedText( String modelIdentifier, String language, String elementIdentifier, String textIdentifier) { TranslateableText t = getTranslateableText(modelIdentifier, elementIdentifier, textIdentifier); if (t == null) { return null; } if ("fr".equals(language)) { return t.getTextFr(); } if ("it".equals(language)) { return t.getTextIt(); } if ("en".equals(language)) { return t.getTextEn(); } return t.getTextDe(); }