diff --git a/sbm-support-rewrite/src/test/java/org/springframework/sbm/test/util/ParserParityTestHelper.java b/sbm-support-rewrite/src/test/java/org/springframework/sbm/test/util/ParserParityTestHelper.java index 5685ba0ad..10ca939c4 100644 --- a/sbm-support-rewrite/src/test/java/org/springframework/sbm/test/util/ParserParityTestHelper.java +++ b/sbm-support-rewrite/src/test/java/org/springframework/sbm/test/util/ParserParityTestHelper.java @@ -238,6 +238,46 @@ private void compareMarker(SoftAssertions softAssertions, Marker comparingMarker private void compareMavenResolutionResultMarker(SoftAssertions softAssertions, MavenResolutionResult comparing, MavenResolutionResult tested) { softAssertions.assertThat(tested) .usingRecursiveComparison() + .withEqualsForFieldsMatchingRegexes( + (Object fi1, Object fi2) -> { + if(fi1 == null) { + if(fi2 == null) { + return true; + } + return false; + } + boolean equals = fi1.equals(fi2); + if(equals) { + return true; + } + if(fi1.getClass() == fi1.getClass()) { + if(fi1 instanceof URI) { + URI f1 = (URI) fi1; + URI f2 = (URI) fi2; + return equals ? true : f1.getScheme().equals(f2.getScheme()) && + f1.getHost().equals(f2.getHost()) && + f1.getPath().equals(f2.getPath()) && + f1.getFragment().equals(f2.getFragment()); + } else if(fi1 instanceof String) { + try { + URI f1 = new URI((String) fi1); + URI f2 = new URI((String) fi2); + return equals ? true : f1.getScheme().equals(f2.getScheme()) && + f1.getHost() == null ? (f2.getHost() == null ? true : false) : f1.getHost().equals(f2.getHost()) && + f1.getPath().equals(f2.getPath()) && + f1.getFragment().equals(f2.getFragment()); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + } else { + return false; + } + } else { + return false; + } + + }, + ".*\\.repository") .ignoringFields( "modules", "dependencies", @@ -276,6 +316,9 @@ private void compareMavenResolutionResultMarker(SoftAssertions softAssertions, M .usingRecursiveComparison() .withEqualsForFieldsMatchingRegexes( (Object fi1, Object fi2) -> { + if(fi1 == null) { + return false; + } boolean equals = fi1.equals(fi2); if(equals) { return true;