@Test
public void testVersionComparable() {

    String unsorted[] = { "1.5", "2.3.1", "1.0", "2.2", "2.3" };
    String expected[] = { "2.3.1", "2.3", "2.2", "1.5", "1.0" };
    List<Version> versions = new ArrayList<Version>();
    for (String u : unsorted) {
        versions.add(new Version(u));
    }
    System.out.printf("Unsorted: %s%n", versions);
    Collections.sort(versions);
    System.out.printf("Sorted: %s%n", versions);
    int len = expected.length;
    Assert.assertEquals("Expected.length", expected.length, versions.size());
    for (int i = 0; i < len; i++) {
        Assert.assertEquals("Expected[" + i + "]", expected[i], versions.get(i).toString());
    }
}