Пример #1
0
  public void testNullsFirst() {
    Ordering<Integer> ordering = Ordering.natural().nullsFirst();
    Helpers.testComparator(ordering, null, Integer.MIN_VALUE, 0, 1);

    new EqualsTester()
        .addEqualityGroup(ordering, Ordering.natural().nullsFirst())
        .addEqualityGroup(numberOrdering.nullsFirst())
        .addEqualityGroup(Ordering.natural())
        .testEquals();
  }
Пример #2
0
 @Test(groups = "ordering")
 public void testNullsFirst() {
   assertEquals(
       byLengthOrdering
           .nullsFirst()
           .sortedCopy(
               Arrays.asList(
                   hanSolo.getName(), null, lukeSkywalker.getName(), null, princessLeia.getName()))
           .toString(),
       "[null, null, Han Solo, Princess Leia, Luke Skywalker]");
 }