From 5ff419848b3fd04dba17ba9088c035848015fd4e Mon Sep 17 00:00:00 2001 From: liamfallon Date: Tue, 1 May 2018 18:13:12 +0100 Subject: Fix Test fail with variable length memory address The unit test class PIPConfigurationTest.java has a test that checks a configuration string for length. However, the length of the "piptype" field in that string can vary, causing the test to intermittently fail. Field that passes: piptype=org.onap.policy.rest.jpa.PIPType@71b3bc45 Field that fails: piptype=org.onap.policy.rest.jpa.PIPType@a8c1f44 This fix removes the memory address from the "piptype" field, so that the configuration string will now always be 323 characters in length. Change-Id: Ib3640ec6f69ac7d691dcc989c44a7822bcc9b7f7 Issue-ID: POLICY-765 Signed-off-by: liamfallon --- .../src/test/java/org/onap/policy/rest/jpa/PIPConfigurationTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ONAP-REST/src/test/java/org') diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPConfigurationTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPConfigurationTest.java index 8d87173b0..1a4c2756b 100644 --- a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPConfigurationTest.java +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPConfigurationTest.java @@ -115,6 +115,7 @@ public class PIPConfigurationTest { assertEquals(id, config.getName()); // Test toString - assertEquals(332, config.toString().length()); + String configString = config.toString().replaceAll("@[0-9a-f]*", ""); + assertEquals(323, configString.length()); } } -- cgit 1.2.3-korg