Пример #1
0
  @Test
  public void testCompareToAllDifferent() {
    AddonSpecification spec1 = new AddonSpecification();
    spec1.setId("ABC");
    spec1.setVersion("1.0.0");
    AddonSpecification spec2 = new AddonSpecification();
    spec2.setId("ZBD");
    spec2.setVersion("1.0.8");
    AddonSpecification spec3 = new AddonSpecification();
    spec3.setId("ABE");
    spec3.setVersion("1.0.25");

    Assert.assertEquals(spec1.compareTo(spec3), -1);
    Assert.assertEquals(spec1.compareTo(spec2), -1);
    Assert.assertEquals(spec2.compareTo(spec3), 1);
  }
Пример #2
0
  @Test
  public void testCompareToIdEquals() {
    AddonSpecification spec1 = new AddonSpecification();
    spec1.setId("ABC");
    spec1.setVersion("1.0.2");
    AddonSpecification spec2 = new AddonSpecification();
    spec2.setId("ABC");
    spec2.setVersion("1.0.5");

    Assert.assertEquals(spec1.compareTo(spec2), -1);
  }