formatted code for ControllerBluPrintsApplication 53/66653/1
authorSandeep J <sandeejh@in.ibm.com>
Fri, 14 Sep 2018 13:43:00 +0000 (19:13 +0530)
committerSandeep J <sandeejh@in.ibm.com>
Fri, 14 Sep 2018 13:46:03 +0000 (19:16 +0530)
added object assignment in setUp method

Issue-ID: CCSDK-552
Change-Id: I485e21b09b9c04bb04a499a0f7bbf8079f8e24d1
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
ms/controllerblueprints/application/src/test/java/org/onap/ccsdk/apps/controllerblueprints/ControllerBluprintsApplicationTest.java

index 32d06d2..39cb0da 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
+ * Modifications Copyright © 2018 IBM.\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  * You may obtain a copy of the License at\r
 \r
 package org.onap.ccsdk.apps.controllerblueprints;\r
 \r
+import static org.assertj.core.api.Assertions.assertThat;\r
+\r
 import org.junit.Assert;\r
 import org.junit.Before;\r
 import org.junit.Test;\r
 import org.junit.runner.RunWith;\r
 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
 import org.springframework.beans.factory.annotation.Autowired;\r
 import org.springframework.boot.test.context.SpringBootTest;\r
 import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;\r
 import org.springframework.boot.test.web.client.TestRestTemplate;\r
-import org.springframework.http.*;\r
+import org.springframework.http.HttpEntity;\r
+import org.springframework.http.HttpHeaders;\r
+import org.springframework.http.HttpMethod;\r
+import org.springframework.http.HttpStatus;\r
+import org.springframework.http.MediaType;\r
+import org.springframework.http.ResponseEntity;\r
 import org.springframework.test.context.junit4.SpringRunner;\r
 \r
-import static org.assertj.core.api.Assertions.assertThat;\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
 \r
 @RunWith(SpringRunner.class)\r
 @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)\r
@@ -39,28 +45,26 @@ public class ControllerBluprintsApplicationTest {
 \r
     @Autowired\r
     private TestRestTemplate restTemplate;\r
+    private HttpHeaders headers;\r
+    private ResponseEntity<ConfigModel> entity;\r
 \r
     @Before\r
     public void setUp(){\r
-\r
+        headers = new HttpHeaders();\r
+        headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);\r
+        entity = this.restTemplate\r
+                .exchange("/api/v1/config-model/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);\r
+        \r
     }\r
 \r
     @Test\r
     public void testConfigModel() {\r
-        HttpHeaders headers = new HttpHeaders();\r
-        headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);\r
-        ResponseEntity<ConfigModel> entity = this.restTemplate\r
-                .exchange("/api/v1/config-model/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);\r
         assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);\r
         Assert.assertNotNull("failed to get response Config model",entity.getBody());\r
     }\r
 \r
     @Test\r
     public void testConfigModelFailure() {\r
-        HttpHeaders headers = new HttpHeaders();\r
-        headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);\r
-        ResponseEntity<ConfigModel> entity = this.restTemplate\r
-                .exchange("/api/v1/config-model-not-found/1", HttpMethod.GET, new HttpEntity<>(headers),ConfigModel.class);\r
         assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);\r
         Assert.assertNotNull("failed to get response Config model",entity.getBody());\r
     }\r