Dependency { protected boolean hasHigherVersion(String anotherVersion) { String[] thisElements = StringUtils.split(version, "."); String[] anotherElements = StringUtils.split(anotherVersion, "."); int length = Math.max(version.length(), anotherElements.length); for (int index = 0; index < length; index++) { int thisUnit = Integer.parseInt(ArrayUtils.get(thisElements, index, "0")); int anotherUnit = Integer.parseInt(ArrayUtils.get(anotherElements, index, "0")); if (thisUnit == anotherUnit) { continue; } return thisUnit > anotherUnit; } return false; } protected  Dependency(String type, String owner, String name, String version); @Override boolean equals(Object o); @Override int hashCode(); String getType(); @Override String toString();  }
@Test void hasHigherVersion() { Assertions.assertTrue(B.hasHigherVersion(A.getVersion())); Assertions.assertTrue(B.hasHigherVersion(C.getVersion())); Assertions.assertFalse(A.hasHigherVersion(C.getVersion())); }