X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Faai%2Fsa%2Frest%2FBulkApiTest.java;h=eff4efc3c05af74b854a9dafa082d2b5746fccc0;hb=15af66b115f3e8046b2d0f2634fb77b3d835f730;hp=c7e9702e3f827b7eebcbce904f76ad338386c0be;hpb=ce701746049abfd94a87b46e43f296faf32d6213;p=aai%2Fsearch-data-service.git diff --git a/src/test/java/org/onap/aai/sa/rest/BulkApiTest.java b/src/test/java/org/onap/aai/sa/rest/BulkApiTest.java index c7e9702..eff4efc 100644 --- a/src/test/java/org/onap/aai/sa/rest/BulkApiTest.java +++ b/src/test/java/org/onap/aai/sa/rest/BulkApiTest.java @@ -24,6 +24,8 @@ package org.onap.aai.sa.rest; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import java.io.File; +import java.io.IOException; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -33,13 +35,10 @@ import org.springframework.http.MediaType; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; -import java.io.File; -import java.io.IOException; /** - * This suite of tests validates the behaviour of the bulk operations REST - * end point. + * This suite of tests validates the behaviour of the bulk operations REST end point. */ @RunWith(SpringRunner.class) @SpringBootTest(classes = org.onap.aai.sa.Application.class) @@ -54,16 +53,16 @@ public class BulkApiTest { @Test public void authenticationFailureTest() throws Exception { - this.mockMvc.perform ( post ( TOP_URI) .contentType( MediaType.APPLICATION_JSON) - .content ( SearchServiceApiHarness.FAIL_AUTHENTICATION_TRIGGER )).andExpect ( status ().isForbidden () ); + this.mockMvc + .perform(post(TOP_URI).contentType(MediaType.APPLICATION_JSON) + .content(SearchServiceApiHarness.FAIL_AUTHENTICATION_TRIGGER)) + .andExpect(status().isForbidden()); } /** - * This test validates that properly constructed json payloads are - * correctly validated and that improperly contructed payloads will - * be rejected with the appropriate response code returned to the - * client. + * This test validates that properly constructed json payloads are correctly validated and that improperly + * contructed payloads will be rejected with the appropriate response code returned to the client. * * @throws IOException */ @@ -72,19 +71,20 @@ public class BulkApiTest { // Post a request to the bulk operations endpoint with a valid // operations list payload. - File validBulkOpsFile = new File ("src/test/resources/json/bulk-ops-valid.json"); + File validBulkOpsFile = new File("src/test/resources/json/bulk-ops-valid.json"); String validPayloadStr = TestUtils.readFileToString(validBulkOpsFile); // Validate that the payload is accepted as expected. - this.mockMvc.perform ( post ( TOP_URI ).contentType ( MediaType.APPLICATION_JSON ) - .content ( validPayloadStr ) ).andExpect ( status ().isOk () ); + this.mockMvc.perform(post(TOP_URI).contentType(MediaType.APPLICATION_JSON).content(validPayloadStr)) + .andExpect(status().isOk()); // Post a request to the bulk operations endpoint with an invalid // operations list payload. File inValidBulkOpsFile = new File("src/test/resources/json/bulk-ops-invalid.json"); String inValidPayloadStr = TestUtils.readFileToString(inValidBulkOpsFile); - ResultActions invalid = this.mockMvc.perform ( post ( TOP_URI ).contentType ( MediaType.APPLICATION_JSON ) - .content ( inValidPayloadStr ) ).andExpect ( status ().isBadRequest ()); + ResultActions invalid = + this.mockMvc.perform(post(TOP_URI).contentType(MediaType.APPLICATION_JSON).content(inValidPayloadStr)) + .andExpect(status().isBadRequest()); } }