diff options
author | Ilpo Ruotsalainen <ilpo.ruotsalainen@oath.com> | 2018-11-30 17:03:49 +0100 |
---|---|---|
committer | Ilpo Ruotsalainen <ilpo.ruotsalainen@oath.com> | 2018-11-30 17:03:49 +0100 |
commit | 90a7dc030c71344e279fd29519526a8fd6ee26b1 (patch) | |
tree | edeaed5cbfa7a0e87a73a4b0a5ba577681a85789 /abi-check-plugin/src | |
parent | e1d0bc427ee3ff535a8eb72f761155e6ecaea775 (diff) |
Extract a method for easier unit testing.
Diffstat (limited to 'abi-check-plugin/src')
-rw-r--r-- | abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java b/abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java index 9187b1e45ac..cd9b545fe8d 100644 --- a/abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java +++ b/abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java @@ -166,10 +166,7 @@ public class AbiCheck extends AbstractMojo { writeSpec(signatures, specFileName); } else { Map<String, JavaClassSignature> abiSpec = readSpec(specFileName); - if (!SetMatcher.compare(abiSpec.keySet(), signatures.keySet(), - item -> matchingClasses(item, abiSpec.get(item), signatures.get(item), getLog()), - item -> getLog().error(String.format("Missing class: %s", item)), - item -> getLog().error(String.format("Extra class: %s", item)))) { + if (!compareSignatures(abiSpec, signatures)) { throw new MojoFailureException("ABI spec mismatch"); } } @@ -177,4 +174,12 @@ public class AbiCheck extends AbstractMojo { throw new MojoExecutionException("Error processing class signatures", e); } } + + private boolean compareSignatures(Map<String, JavaClassSignature> expected, + Map<String, JavaClassSignature> actual) { + return SetMatcher.compare(expected.keySet(), actual.keySet(), + item -> matchingClasses(item, expected.get(item), actual.get(item), getLog()), + item -> getLog().error(String.format("Missing class: %s", item)), + item -> getLog().error(String.format("Extra class: %s", item))); + } } |