/** * Tests the string representation. */ @Test public void testToString() { final String s = init.toString(); final Pattern pattern = Pattern .compile("ConstantInitializer@-?\\d+ \\[ object = " + VALUE + " \\]"); assertTrue("Wrong string: " + s, pattern.matcher(s).matches()); }
/** * Tests the string representation if the managed object is null. */ @Test public void testToStringNull() { final String s = new ConstantInitializer<>(null).toString(); assertTrue("Object not found: " + s, s.indexOf("object = null") > 0); } }