aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test/java
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-02-27 11:31:34 -0500
committerJim Hahn <jrh3@att.com>2019-02-27 18:39:15 -0500
commitc3e2ced55c33946377454f2353dc24297e88584d (patch)
tree9a3dddbcc1b58e074197a2d9da4da075ea9d667f /main/src/test/java
parent6329d5933f064f9418b300ef87235681fabd717d (diff)
Use Coder class
Modified existing PAP code to use the Coder class instead of Gson. Change-Id: I770d0adf201d7c1118085f85c36582e1143deb08 Issue-ID: POLICY-1444 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'main/src/test/java')
-rw-r--r--main/src/test/java/org/onap/policy/pap/main/parameters/TestPapParameterHandler.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/parameters/TestPapParameterHandler.java b/main/src/test/java/org/onap/policy/pap/main/parameters/TestPapParameterHandler.java
index cb14748d..b0f9521d 100644
--- a/main/src/test/java/org/onap/policy/pap/main/parameters/TestPapParameterHandler.java
+++ b/main/src/test/java/org/onap/policy/pap/main/parameters/TestPapParameterHandler.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +25,9 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.io.FileNotFoundException;
import org.junit.Test;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.pap.main.PolicyPapException;
import org.onap.policy.pap.main.startstop.PapCommandLineArguments;
@@ -46,7 +49,8 @@ public class TestPapParameterHandler {
new PapParameterHandler().getParameters(noArguments);
fail("test should throw an exception here");
} catch (final Exception e) {
- assertTrue(e.getMessage().contains("FileNotFoundException"));
+ assertTrue(e.getCause() instanceof CoderException);
+ assertTrue(e.getCause().getCause() instanceof FileNotFoundException);
}
}
@@ -76,9 +80,9 @@ public class TestPapParameterHandler {
new PapParameterHandler().getParameters(invalidArguments);
fail("test should throw an exception here");
} catch (final Exception e) {
- assertEquals("error reading parameters from \"parameters/InvalidParameters.json\"\n"
- + "(JsonSyntaxException):java.lang.IllegalStateException: "
- + "Expected a string but was BEGIN_ARRAY at line 2 column 15 path $.name", e.getMessage());
+ assertTrue(e.getMessage().startsWith(
+ "error reading parameters from \"parameters/InvalidParameters.json\""));
+ assertTrue(e.getCause() instanceof CoderException);
}
}