コード例 #1
0
 @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));
 }
コード例 #2
0
 @Test
 public void testDeleteTexts() {
   modelElementDisplayController.setLang("fr");
   TranslateableText text = mock(TranslateableText.class);
   when(text.getElementIdentifier()).thenReturn("element");
   when(text.getModelIdentifier()).thenReturn("model_identifier");
   when(text.getTextIdentifier()).thenReturn("text_identifier");
   EPFModel model = mock(EPFModel.class);
   ModelElement modelElement = mock(ModelElement.class);
   when(model.isPublished()).thenReturn(false);
   when(modelElementDisplayController.webPublisherFacade.getModel(anyString())).thenReturn(model);
   when(modelElementDisplayController.webPublisherFacade.getModelElement(anyString(), anyString()))
       .thenReturn(modelElement);
   SelectableRow<TranslateableText> row = new SelectableRow<TranslateableText>(text);
   row.setSelected(true);
   modelElementDisplayController.translateableTexts =
       new ArrayList<SelectableRow<TranslateableText>>();
   modelElementDisplayController.translateableTexts.add(row);
   modelElementDisplayController.deleteTexts();
   verify(modelElementDisplayController.webPublisherFacade)
       .deleteTranslateableText("model_identifier", "element", "text_identifier", "fr");
 }
コード例 #3
0
 @Before
 public void setUp() throws Exception {
   modelElementDisplayController = new ModelElementDisplayController();
   modelElementDisplayController.webPublisherFacade = mock(WebPublisherFacade.class);
   modelElementDisplayController.imageUrlUtil = mock(ImageUrlUtil.class);
 }