aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/application/src
diff options
context:
space:
mode:
authorSandeep J <sandeejh@in.ibm.com>2018-09-14 19:13:00 +0530
committerSandeep J <sandeejh@in.ibm.com>2018-09-14 19:16:03 +0530
commitd34fbed5ee59e6208e9d85e48e574a8132a130d9 (patch)
tree33297901cd7a129202a3ca56412e232e83089703 /ms/controllerblueprints/application/src
parent68778581d3d82dc6adfcf55c2163bc13da76d7b6 (diff)
formatted code for ControllerBluPrintsApplication
added object assignment in setUp method Issue-ID: CCSDK-552 Change-Id: I485e21b09b9c04bb04a499a0f7bbf8079f8e24d1 Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/application/src')
-rw-r--r--ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java32
1 files changed, 18 insertions, 14 deletions
diff --git a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java
index 32d06d2e..39cb0da3 100644
--- a/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java
+++ b/ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java
@@ -1,6 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
- *
+ * Modifications Copyright © 2018 IBM.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -16,21 +16,27 @@
package org.onap.ccsdk.apps.controllerblueprints;
+import static org.assertj.core.api.Assertions.assertThat;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.http.*;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
-import static org.assertj.core.api.Assertions.assertThat;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@@ -39,28 +45,26 @@ public class ControllerBluprintsApplicationTest {
@Autowired
private TestRestTemplate restTemplate;
+ private HttpHeaders headers;
+ private ResponseEntity<ConfigModel> entity;
@Before
public void setUp(){
-
+ headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
+ entity = this.restTemplate
+ .exchange("/api/v1/config-model/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);
+
}
@Test
public void testConfigModel() {
- HttpHeaders headers = new HttpHeaders();
- headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
- ResponseEntity<ConfigModel> entity = this.restTemplate
- .exchange("/api/v1/config-model/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
Assert.assertNotNull("failed to get response Config model",entity.getBody());
}
@Test
public void testConfigModelFailure() {
- HttpHeaders headers = new HttpHeaders();
- headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
- ResponseEntity<ConfigModel> entity = this.restTemplate
- .exchange("/api/v1/config-model-not-found/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
Assert.assertNotNull("failed to get response Config model",entity.getBody());
}