コード例 #1
0
  @Test
  public void testPropertyComparator() {
    Dog dog = new Dog();
    dog.setNickName("mace");

    Dog dog2 = new Dog();
    dog2.setNickName("biscy");

    PropertyComparator c = new PropertyComparator("nickName", false, true);
    assertTrue(c.compare(dog, dog2) > 0);
    assertTrue(c.compare(dog, dog) == 0);
    assertTrue(c.compare(dog2, dog) < 0);
  }
コード例 #2
0
 @Test
 public void testPropertyComparatorNulls() {
   Dog dog = new Dog();
   Dog dog2 = new Dog();
   PropertyComparator c = new PropertyComparator("nickName", false, true);
   assertTrue(c.compare(dog, dog2) == 0);
 }