From 1cdad9b78056103a4ca1d1b71d996489787ed702 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Tue, 18 Jun 2019 12:47:14 -0400 Subject: Change getCanonicalName to getName in models Per javadocs, getName() should generally be used instead of Class.getCanonicalName(). This change only applies to classes; it does not apply to File objects. Note: this impacts the output from PfValidationMessage, as it will now list the names of embedded classes with a "$" separator instead of a ".". Change-Id: I2cd64bc0281dd324bf80eac57335a7299a516447 Issue-ID: POLICY-1646 Signed-off-by: Jim Hahn --- .../src/test/java/org/onap/policy/models/base/ValidatedTest.java | 8 ++++---- .../src/test/java/org/onap/policy/models/base/ValidationTest.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'models-base/src/test/java/org') diff --git a/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java b/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java index 120ddbff9..64612238b 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/ValidatedTest.java @@ -290,13 +290,13 @@ public class ValidatedTest { // check first item PfValidationMessage msg = it.next(); - assertEquals(MyValid.class.getName().replace('$', '.'), msg.getObservedClass()); + assertEquals(MyValid.class.getName(), msg.getObservedClass()); assertEquals(MY_TO_STRING, msg.getObservedKey().toString()); assertTrue(msg.getMessage().contains("index.0 invalid-wrong value")); // check null value msg = it.next(); - assertEquals(MyValid.class.getName().replace('$', '.'), msg.getObservedClass()); + assertEquals(MyValid.class.getName(), msg.getObservedClass()); assertEquals(MY_TO_STRING, msg.getObservedKey().toString()); assertTrue(msg.getMessage().contains("index.2 invalid-wrong value")); @@ -327,13 +327,13 @@ public class ValidatedTest { // check first item PfValidationMessage msg = it.next(); - assertEquals(MyConcept.class.getName().replace('$', '.'), msg.getObservedClass()); + assertEquals(MyConcept.class.getName(), msg.getObservedClass()); assertEquals(MY_TO_STRING, msg.getObservedKey().toString()); assertTrue(msg.getMessage().contains("index.0 invalid-wrong value")); // check null value msg = it.next(); - assertEquals(MyConcept.class.getName().replace('$', '.'), msg.getObservedClass()); + assertEquals(MyConcept.class.getName(), msg.getObservedClass()); assertEquals(MY_TO_STRING, msg.getObservedKey().toString()); assertTrue(msg.getMessage().contains("index.2 invalid-wrong value")); diff --git a/models-base/src/test/java/org/onap/policy/models/base/ValidationTest.java b/models-base/src/test/java/org/onap/policy/models/base/ValidationTest.java index ef0d8d609..d536e406f 100644 --- a/models-base/src/test/java/org/onap/policy/models/base/ValidationTest.java +++ b/models-base/src/test/java/org/onap/policy/models/base/ValidationTest.java @@ -88,7 +88,7 @@ public class ValidationTest { assertEquals(PfValidationResult.ValidationResult.INVALID, result.getMessageList().get(3).getValidationResult()); assertEquals(SOME_MESSAGE, result.getMessageList().get(3).getMessage()); - assertEquals(PfConceptKey.class.getCanonicalName(), result.getMessageList().get(3).getObservedClass()); + assertEquals(PfConceptKey.class.getName(), result.getMessageList().get(3).getObservedClass()); assertEquals(PfConceptKey.getNullKey(), result.getMessageList().get(3).getObservedKey()); } } -- cgit 1.2.3-korg