Skip to content

Commit

Permalink
A config proxy's toString() method's output can change subtly under d…
Browse files Browse the repository at this point in the history
…ifferent JDKs.

Since we don't actually care about the details of the output, lets relax the test.
  • Loading branch information
rgallardo-netflix committed May 21, 2024
1 parent d77a3e3 commit 0cf06f4
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,10 @@ public void testObjectMethods() {
PropertyFactory factory = DefaultPropertyFactory.from(config);
ConfigProxyFactory proxy = new ConfigProxyFactory(config, config.getDecoder(), factory);
WithArguments withArgs = proxy.newProxy(WithArguments.class);

assertEquals("WithArguments[${0}.def.${1}='[]',${0}.abc.${1}='default',${0}.def.${1}='null',${0}.def.${1}='[default1, default2]']", withArgs.toString());

// An older version of this test used to check the entire string, but that's too fragile because the
// order of the method descriptors is not stable under different JDKs.
assertTrue(withArgs.toString().startsWith("WithArguments["), "Expected toString() to start with the simple name of the proxy class" );
//noinspection ObviousNullCheck
assertNotNull(withArgs.hashCode());
//noinspection EqualsWithItself
Expand Down

0 comments on commit 0cf06f4

Please sign in to comment.