Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wwelling committed Nov 28, 2018
1 parent e856980 commit 2ad5c99
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.util.ReflectionTestUtils;

Expand Down Expand Up @@ -190,29 +189,29 @@ public void testPushRequest() throws Exception {
when(remoteProjectManagementBean.push(TEST_FEATURE_REQUEST)).thenReturn(TEST_FEATURE_REQUEST);
when(managementBeanRegistry.getService(any(String.class))).thenReturn(remoteProjectManagementBean);
when(projectRepo.findOne(any(Long.class))).thenReturn(TEST_PROJECT1);
apiResponse = projectController.pushRequest(new MockHttpServletRequest(), TEST_FEATURE_REQUEST);
apiResponse = projectController.pushRequest(TEST_FEATURE_REQUEST);
assertEquals("Project controller did not push request", SUCCESS, apiResponse.getMeta().getStatus());
}

@Test
public void testPushRequestToInvalidRemoteProjectManager() {
when(projectRepo.findOne(any(Long.class))).thenReturn(TEST_PROJECT1);
apiResponse = projectController.pushRequest(new MockHttpServletRequest(), TEST_INVALID_FEATURE_REQUEST);
apiResponse = projectController.pushRequest(TEST_INVALID_FEATURE_REQUEST);
assertEquals("Invalid push did not throw an exception", ERROR, apiResponse.getMeta().getStatus());
assertEquals("Push without Remote Project Manager did not result in the expected error", PUSH_ERROR_MESSAGE, apiResponse.getMeta().getMessage());
}

@Test
public void testPushRequestWithoutRemoteProjectManager() {
when(projectRepo.findOne(any(Long.class))).thenReturn(TEST_PROJECT_WIHTOUT_RPM);
apiResponse = projectController.pushRequest(new MockHttpServletRequest(), TEST_FEATURE_REQUEST_WIHTOUT_VMS);
apiResponse = projectController.pushRequest(TEST_FEATURE_REQUEST_WIHTOUT_VMS);
assertEquals("Push without Remote Project Manager did not result in an error", ERROR, apiResponse.getMeta().getStatus());
assertEquals("Push without Remote Project Manager did not result in the expected error", NO_RPM_ERROR_MESSAGE, apiResponse.getMeta().getMessage());
}

@Test
public void testPushRequestWithoutProject() {
apiResponse = projectController.pushRequest(new MockHttpServletRequest(), TEST_FEATURE_REQUEST_WITHOUT_PROJECT);
apiResponse = projectController.pushRequest(TEST_FEATURE_REQUEST_WITHOUT_PROJECT);
assertEquals("Push without Project did not result in an error", ERROR, apiResponse.getMeta().getStatus());
assertEquals("Push without Project did not result in the expected error", NO_PROJECT_ERROR_MESSAGE, apiResponse.getMeta().getMessage());
}
Expand Down

0 comments on commit 2ad5c99

Please sign in to comment.