1 package org.onap.crud.event.response;
3 import static org.hamcrest.Matchers.is;
4 import static org.junit.Assert.assertThat;
6 import org.onap.crud.event.envelope.GraphEventEnvelope;
7 import org.onap.crud.test.util.TestUtil;
8 import com.google.gson.Gson;
10 public class GraphEventResponseHandlerTest {
13 public void testPolicyViolationsNotDetected() throws Exception {
14 String expectedEnvelope = TestUtil.getFileAsString("event/event-envelope-sentinel-no-violations.json");
15 Gson gson = new Gson();
16 GraphEventEnvelope envelope = gson.fromJson(expectedEnvelope, GraphEventEnvelope.class);
18 GraphEventResponseHandler graphEventResponseHandler = new GraphEventResponseHandler();
19 assertThat(graphEventResponseHandler.hasPolicyViolations(envelope), is(false));
23 public void testPolicyViolationsDetected() throws Exception {
24 String expectedEnvelope = TestUtil.getFileAsString("event/event-envelope-sentinel.json");
25 Gson gson = new Gson();
26 GraphEventEnvelope envelope = gson.fromJson(expectedEnvelope, GraphEventEnvelope.class);
28 GraphEventResponseHandler graphEventResponseHandler = new GraphEventResponseHandler();
29 assertThat(graphEventResponseHandler.hasPolicyViolations(envelope), is(true));