From d2e0902630ccf06bb466360e036212f5060b9055 Mon Sep 17 00:00:00 2001 From: YiLi Date: Tue, 27 Feb 2018 15:26:41 +0800 Subject: Replace Jackson with GSON Change-Id: Ifffe7aca1116e2706d66ecb682697df521785b57 Issue-ID: HOLMES-115 Signed-off-by: YiLi --- .../org/onap/holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java | 5 +++-- .../java/org/onap/holmes/rulemgt/resources/RuleMgtResourcesTest.java | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'rulemgt/src/test') diff --git a/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java index a330306..8d16198 100644 --- a/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/dcae/DcaeConfigurationPollingTest.java @@ -21,6 +21,7 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; import static org.powermock.api.mockito.PowerMockito.when; +import com.alibaba.fastjson.JSONException; import com.fasterxml.jackson.databind.ObjectMapper; import javax.ws.rs.ProcessingException; import org.junit.Before; @@ -57,13 +58,13 @@ public class DcaeConfigurationPollingTest { public void testDaceConfigurationPolling_getDcaeConfigurations_exception() throws Exception { PowerMock.resetAll(); thrown.expect(CorrelationException.class); - thrown.expectMessage("host"); + thrown.expectMessage("syntax error, pos 1"); PowerMockito.mockStatic(MicroServiceConfig.class); when(MicroServiceConfig.getServiceConfigInfoFromCBS("holmes-rule-mgmt")) .thenReturn("host"); PowerMock.createMock(DcaeConfigurationParser.class); PowerMock.expectPrivate(DcaeConfigurationParser.class, "parse", "host") - .andThrow(new CorrelationException("tests")).anyTimes(); + .andThrow(new CorrelationException("")).anyTimes(); PowerMock.replayAll(); Whitebox.invokeMethod(daceConfigurationPolling, "getDcaeConfigurations"); diff --git a/rulemgt/src/test/java/org/onap/holmes/rulemgt/resources/RuleMgtResourcesTest.java b/rulemgt/src/test/java/org/onap/holmes/rulemgt/resources/RuleMgtResourcesTest.java index 692cc19..0c3bd89 100644 --- a/rulemgt/src/test/java/org/onap/holmes/rulemgt/resources/RuleMgtResourcesTest.java +++ b/rulemgt/src/test/java/org/onap/holmes/rulemgt/resources/RuleMgtResourcesTest.java @@ -16,6 +16,7 @@ package org.onap.holmes.rulemgt.resources; +import com.google.gson.JsonSyntaxException; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.WebApplicationException; import org.easymock.EasyMock; @@ -147,7 +148,7 @@ public class RuleMgtResourcesTest { @Test public void getCorrelationRules_param_translate_exception() { - thrown.expect(WebApplicationException.class); + thrown.expect(JsonSyntaxException.class); String queryRequest = "this is error param"; EasyMock.expect(request.getHeader("language-option")).andReturn("en_US").times(2); -- cgit 1.2.3-korg