use of org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse in project so by onap.
the class ActivitySpecsActionsTest method CreateActivitySpecReturnsExists_Test.
@Test
public void CreateActivitySpecReturnsExists_Test() throws Exception {
String HOSTNAME = createURLWithPort("");
ActivitySpec activitySpec = new ActivitySpec();
activitySpec.setName("testActivitySpec");
activitySpec.setDescription("Test Activity Spec");
ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse();
activitySpecCreateResponse.setId("testActivityId");
ObjectMapper mapper = new ObjectMapper();
String body = mapper.writeValueAsString(activitySpecCreateResponse);
wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")).willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(org.springframework.http.HttpStatus.UNPROCESSABLE_ENTITY.value()).withBody(body)));
String activitySpecId = activitySpecsActions.createActivitySpec(HOSTNAME, activitySpec);
assertEquals(null, activitySpecId);
}
use of org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse in project so by onap.
the class ActivitySpecsActionsTest method CreateActivitySpec_Test.
@Test
public void CreateActivitySpec_Test() throws Exception {
String HOSTNAME = createURLWithPort("");
ActivitySpec activitySpec = new ActivitySpec();
activitySpec.setName("testActivitySpec");
activitySpec.setDescription("Test Activity Spec");
ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse();
activitySpecCreateResponse.setId("testActivityId");
ObjectMapper mapper = new ObjectMapper();
String body = mapper.writeValueAsString(activitySpecCreateResponse);
wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")).willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(org.springframework.http.HttpStatus.OK.value()).withBody(body)));
String activitySpecId = activitySpecsActions.createActivitySpec(HOSTNAME, activitySpec);
assertEquals("testActivityId", activitySpecId);
}
Aggregations