use of org.eclipse.che.ide.api.filetypes.FileType in project che by eclipse.
the class DebuggerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
super.setUp();
debuggerDescriptor = new DebuggerDescriptor(NAME + " " + VERSION, HOST + ":" + PORT);
doReturn(locationDto).when(dtoFactory).createDto(LocationDto.class);
doReturn(breakpointDto).when(dtoFactory).createDto(BreakpointDto.class);
doReturn(locationDto).when(breakpointDto).getLocation();
doReturn(messageBus).when(messageBusProvider).getMachineMessageBus();
doReturn(localStorage).when(localStorageProvider).get();
doReturn(DEBUG_INFO).when(localStorage).getItem(AbstractDebugger.LOCAL_STORAGE_DEBUGGER_SESSION_KEY);
doReturn(debugSessionDto).when(dtoFactory).createDtoFromJson(anyString(), eq(DebugSessionDto.class));
doReturn(Path.valueOf(PATH)).when(file).getLocation();
debugger = new TestDebugger(service, dtoFactory, localStorageProvider, messageBusProvider, eventBus, activeFileHandler, debuggerManager, notificationManager, "id");
doReturn(promiseInfo).when(service).getSessionInfo(SESSION_ID);
doReturn(promiseInfo).when(promiseInfo).then(any(Operation.class));
// setup messageBus
verify(eventBus).addHandler(eq(WsAgentStateEvent.TYPE), extServerStateHandlerCaptor.capture());
extServerStateHandlerCaptor.getValue().onWsAgentStarted(WsAgentStateEvent.createWsAgentStartedEvent());
debugger.addObserver(observer);
FileType fileType = mock(FileType.class);
doReturn("java").when(fileType).getExtension();
}
use of org.eclipse.che.ide.api.filetypes.FileType in project che by eclipse.
the class EditorTabWidgetTest method virtualFileShouldBeUpdated.
@Test
public void virtualFileShouldBeUpdated() throws Exception {
EditorInput editorInput = mock(EditorInput.class);
FileType fileType = mock(FileType.class);
VirtualFile newFile = mock(VirtualFile.class);
when(editorPartPresenter.getEditorInput()).thenReturn(editorInput);
when(fileTypeRegistry.getFileTypeByFile(newFile)).thenReturn(fileType);
when(fileType.getImage()).thenReturn(icon);
when(editorInput.getFile()).thenReturn(newFile);
assertNotEquals(tab.getFile(), newFile);
tab.update(editorPartPresenter);
assertEquals(tab.getFile(), newFile);
}
use of org.eclipse.che.ide.api.filetypes.FileType in project che by eclipse.
the class EditorTabWidgetTest method tabIconShouldBeUpdatedWhenMediaTypeChanged.
@Test
public void tabIconShouldBeUpdatedWhenMediaTypeChanged() {
EditorInput editorInput = mock(EditorInput.class);
FileType fileType = mock(FileType.class);
when(editorPartPresenter.getEditorInput()).thenReturn(editorInput);
when(fileTypeRegistry.getFileTypeByFile(file)).thenReturn(fileType);
when(fileType.getImage()).thenReturn(icon);
when(editorInput.getFile()).thenReturn(file);
tab.update(editorPartPresenter);
verify(editorPartPresenter, times(2)).getEditorInput();
verify(fileTypeRegistry).getFileTypeByFile(file);
verify(tab.iconPanel).setWidget(Matchers.<SVGImage>anyObject());
}
use of org.eclipse.che.ide.api.filetypes.FileType in project che by eclipse.
the class RecipeEditorPanelTest method editorShouldBeInitializedAndShowed.
@Test
public void editorShouldBeInitializedAndShowed() throws Exception {
FileType fileType = mock(FileType.class);
when(fileTypeRegistry.getFileTypeByFile(recipeFile)).thenReturn(fileType);
presenter.showEditor();
verify(recipeDescriptor).getScript();
verify(recipeFileFactory).newInstance(SOME_TEXT);
verify(orionTextEditorFactory).get();
verify(editor).activate();
verify(editor).onOpen();
verify(view).showEditor(editor);
}
use of org.eclipse.che.ide.api.filetypes.FileType in project che by eclipse.
the class RecipeEditorPanelTest method editorShouldBeShowed.
@Test
public void editorShouldBeShowed() throws Exception {
FileType fileType = mock(FileType.class);
when(fileTypeRegistry.getFileTypeByFile(recipeFile)).thenReturn(fileType);
presenter.showEditor();
presenter.showEditor();
verify(recipeDescriptor).getScript();
verify(recipeFileFactory).newInstance(SOME_TEXT);
verify(orionTextEditorFactory).get();
verify(editor).activate();
verify(editor).onOpen();
verify(view).showEditor(editor);
}
Aggregations