TasksController { @RequestMapping public List<GetTasksResponse> getTasks() { if (frameworkState.isRegistered()) { return scheduler.getTasks().entrySet().stream().map(this::from).collect(toList()); } else { return new ArrayList<>(0); } }  @RequestMapping List<GetTasksResponse> getTasks();  }
@Test public void shouldNotCrashWhenFrameworkNotRegistered() { Mockito.when(frameworkState.isRegistered()).thenReturn(false); List<TasksController.GetTasksResponse> tasks = controller.getTasks(); assertTrue(tasks.isEmpty()); }