aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-ve-vnfm-adapter/src/test/java
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-02-10 17:02:50 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-10 17:02:50 +0000
commitc1dacabbcf9f9f09a00458b44f5168f1273965ec (patch)
tree2c75049bba2978dca7b24889eb14354a0b68f4f1 /adapters/mso-ve-vnfm-adapter/src/test/java
parentac1a59fc6731c6261712eac5bec76816b11d1096 (diff)
parent37dad48713382ce04354e2231bd2938246f45340 (diff)
Merge "Added communication with DMaaP"
Diffstat (limited to 'adapters/mso-ve-vnfm-adapter/src/test/java')
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
index 418c2e2201..57638a165a 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
@@ -21,6 +21,9 @@
package org.onap.so.adapters.vevnfm.controller;
import static org.junit.Assert.assertEquals;
+import static org.springframework.test.web.client.ExpectedCount.once;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.anything;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -33,11 +36,13 @@ import org.springframework.http.MediaType;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.WebApplicationContext;
@SpringBootTest
@@ -54,11 +59,16 @@ public class NotificationControllerTest {
@Autowired
private WebApplicationContext webApplicationContext;
+ @Autowired
+ private RestTemplate restTemplate;
+
private MockMvc mvc;
+ private MockRestServiceServer mockRestServer;
@Before
public void init() {
mvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
+ mockRestServer = MockRestServiceServer.bindTo(restTemplate).build();
}
@Test
@@ -67,6 +77,8 @@ public class NotificationControllerTest {
final MockHttpServletRequestBuilder request = MockMvcRequestBuilders.post(notificationUrl)
.contentType(MediaType.APPLICATION_JSON).content(MINIMAL_JSON_CONTENT);
+ mockRestServer.expect(once(), anything()).andRespond(withSuccess());
+
// when
final MvcResult mvcResult = mvc.perform(request).andReturn();
@@ -74,5 +86,6 @@ public class NotificationControllerTest {
final MockHttpServletResponse response = mvcResult.getResponse();
assertEquals(HttpStatus.OK.value(), response.getStatus());
assertEquals(ZERO, response.getContentLength());
+ mockRestServer.verify();
}
}