@Test public void workspaceShouldBeStopped() throws Exception { when(event.isDev()).thenReturn(true); when(event.getEventType()).thenReturn(DESTROYED); when(workspaceManager.getWorkspace(anyString())).thenReturn(workspace); when(workspace.getStatus()).thenReturn(WorkspaceStatus.RUNNING); listener.onEvent(event); verify(workspaceManager).stopWorkspace(anyString()); }
@Test public void workspaceShouldNotBeStoppedWhenItIsNotRunning() throws Exception { when(event.isDev()).thenReturn(true); when(event.getEventType()).thenReturn(DESTROYED); when(workspaceManager.getWorkspace(anyString())).thenReturn(workspace); when(workspace.getStatus()).thenReturn(WorkspaceStatus.STOPPED); listener.onEvent(event); verify(workspaceManager, never()).stopWorkspace(anyString()); }