X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=models-base%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fmodels%2Fbase%2FExceptionsTest.java;h=112f6a2038ba36a1cb86fdc7cff0fc1ddb25cab2;hb=9c5d23395918a739b591667edd77e3ced9cd4bfb;hp=664e3ddbc889deaac450099dac2631cb087ed050;hpb=fd6105c2b65f51e229040bd4f6587af048d222a8;p=policy%2Fmodels.git diff --git a/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java b/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java index 664e3ddbc..112f6a203 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/ExceptionsTest.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,32 +25,33 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.io.IOException; - import javax.ws.rs.core.Response; - import org.junit.Test; import org.onap.policy.models.errors.concepts.ErrorResponse; public class ExceptionsTest { + private static final String STRING_TEXT = "String"; + private static final String MESSAGE = "Message"; + @Test public void test() { - assertNotNull(new PfModelException(Response.Status.OK, "Message")); - assertNotNull(new PfModelException(Response.Status.OK, "Message", "String")); - assertNotNull(new PfModelException(Response.Status.OK, "Message", new IOException())); - assertNotNull(new PfModelException(Response.Status.OK, "Message", new IOException(), "String")); + assertNotNull(new PfModelException(Response.Status.OK, MESSAGE)); + assertNotNull(new PfModelException(Response.Status.OK, MESSAGE, STRING_TEXT)); + assertNotNull(new PfModelException(Response.Status.OK, MESSAGE, new IOException())); + assertNotNull(new PfModelException(Response.Status.OK, MESSAGE, new IOException(), STRING_TEXT)); String key = "A String"; PfModelException ae = - new PfModelException(Response.Status.OK, "Message", new IOException("IO exception message"), key); + new PfModelException(Response.Status.OK, MESSAGE, new IOException("IO exception message"), key); ErrorResponse errorResponse = ae.getErrorResponse(); assertEquals("Message\nIO exception message", String.join("\n", errorResponse.getErrorDetails())); assertEquals(key, ae.getObject()); - assertNotNull(new PfModelRuntimeException(Response.Status.OK, "Message")); - assertNotNull(new PfModelRuntimeException(Response.Status.OK, "Message", "String")); - assertNotNull(new PfModelRuntimeException(Response.Status.OK, "Message", new IOException())); - assertNotNull(new PfModelRuntimeException(Response.Status.OK, "Message", new IOException(), "String")); + assertNotNull(new PfModelRuntimeException(Response.Status.OK, MESSAGE)); + assertNotNull(new PfModelRuntimeException(Response.Status.OK, MESSAGE, STRING_TEXT)); + assertNotNull(new PfModelRuntimeException(Response.Status.OK, MESSAGE, new IOException())); + assertNotNull(new PfModelRuntimeException(Response.Status.OK, MESSAGE, new IOException(), STRING_TEXT)); String rkey = "A String"; PfModelRuntimeException re = new PfModelRuntimeException(Response.Status.OK, "Runtime Message",