Fix Test fail with variable length memory address 75/45475/1
authorliamfallon <liam.fallon@ericsson.com>
Tue, 1 May 2018 17:13:12 +0000 (18:13 +0100)
committerliamfallon <liam.fallon@ericsson.com>
Tue, 1 May 2018 17:15:54 +0000 (18:15 +0100)
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 <liam.fallon@ericsson.com>
ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPConfigurationTest.java

index 8d87173..1a4c275 100644 (file)
@@ -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());
   }
 }