@Test public void assertCanAccessProject_if_not_owner_nor_member_fails() { // GIVEN Project project = new Project(); project.setOwnerId(498464L); when(this.mockProjectRepository.findOne(PROJECT_ID)).thenReturn(project); // THEN this.expectedEx.expect(AuthorizationException.class); // WHEN this.authorizationService.assertCanAccessProject(USER_ID, PROJECT_ID); }
@Test public void assertCanAccessTodo_if_owner_of_the_project_is_ok() { // GIVEN Project project = new Project(); project.setOwnerId(USER_ID); when(this.mockTodoRepository.findProject(TODO_ID)).thenReturn(project); // WHEN this.authorizationService.assertCanAccessTodo(USER_ID, TODO_ID); // THEN // Nothing happens }
@Test public void assertCanAccessProject_if_owner_is_ok() { // GIVEN Project project = new Project(); project.setOwnerId(USER_ID); when(this.mockProjectRepository.findOne(PROJECT_ID)).thenReturn(project); // WHEN this.authorizationService.assertCanAccessProject(USER_ID, PROJECT_ID); // THEN // Nothing happens }
@Test public void assertCanAccessTodo_if_not_owner_nor_member_of_the_project_fails() { // GIVEN Project project = new Project(); project.setOwnerId(5546L); when(this.mockTodoRepository.findProject(TODO_ID)).thenReturn(project); // THEN this.expectedEx.expect(AuthorizationException.class); // WHEN this.authorizationService.assertCanAccessTodo(USER_ID, TODO_ID); }