use of org.eclipse.sw360.datahandler.entitlement.ProjectModerator in project sw360portal by sw360.
the class ProjectHandlerTest method testUpdateProject2_1.
@Test
public void testUpdateProject2_1() throws Exception {
ProjectModerator moderator = Mockito.mock(ProjectModerator.class);
ProjectDatabaseHandler handler = new ProjectDatabaseHandler(DatabaseSettings.getConfiguredHttpClient(), dbName, attachmentDbName, moderator, new ComponentDatabaseHandler(DatabaseSettings.getConfiguredHttpClient(), dbName, attachmentDbName));
Project project2 = handler.getProjectById("P2", user1);
project2.setName("Project2new");
Mockito.doReturn(RequestStatus.SENT_TO_MODERATOR).when(moderator).updateProject(project2, user1);
RequestStatus status = handler.updateProject(project2, user1);
// Now contributors can also change the project
assertEquals(RequestStatus.SUCCESS, status);
// assertEquals(RequestStatus.SENT_TO_MODERATOR, status);
// assertEquals("Project2", handler.getProjectById("P2", user1).getName());
// Mockito.verify(moderator, times(1)).updateProject(project2, user1.getEmail());
// Mockito.verifyNoMoreInteractions(moderator);
}
Aggregations