### Question:
VersionComparator implements Comparator<String> { public boolean isComparable(String str) { return str.matches("\\d+\\.\\d+(\\.\\d+)?(\\-[A-Z0-9]+)?"); }  boolean isComparable(String str); @Override int compare(final String o1, final String o2);  }### Answer:
@Test public void testIsComparable() { final VersionComparator comparator = new VersionComparator(); assertTrue(comparator.isComparable("1.2.3")); assertTrue(comparator.isComparable("423423.43252.3432")); assertTrue(comparator.isComparable("1.2")); assertTrue(comparator.isComparable("1.2.3-FOO")); assertTrue(comparator.isComparable("311.242-FOO")); assertTrue(comparator.isComparable("5.2-RC1")); assertFalse(comparator.isComparable("UNKNOWN")); assertFalse(comparator.isComparable("a.b.c")); assertFalse(comparator.isComparable("5.2RC1")); }