Search in sources :

Example 1 with DistributedComparator

use of com.hazelcast.jet.function.DistributedComparator in project hazelcast-jet by hazelcast.

the class DistributedComparatorsTest method nullsFirst_withoutWrapped.

@Test
public void nullsFirst_withoutWrapped() {
    DistributedComparator c = nullsFirst(null);
    assertEquals(0, c.compare(1, 2));
    assertEquals(0, c.compare(2, 1));
    assertEquals(1, c.compare(0, null));
    assertEquals(-1, c.compare(null, 0));
}
Also used : DistributedComparator(com.hazelcast.jet.function.DistributedComparator) Test(org.junit.Test)

Example 2 with DistributedComparator

use of com.hazelcast.jet.function.DistributedComparator in project hazelcast-jet by hazelcast.

the class DistributedComparatorsTest method nullsFirstComparator.

@Test
public void nullsFirstComparator() {
    DistributedComparator c = nullsFirst(NATURAL_ORDER);
    assertEquals(-1, c.compare(1, 2));
    assertEquals(1, c.compare(2, 1));
    assertEquals(1, c.compare(0, null));
    assertEquals(-1, c.compare(null, 0));
}
Also used : DistributedComparator(com.hazelcast.jet.function.DistributedComparator) Test(org.junit.Test)

Example 3 with DistributedComparator

use of com.hazelcast.jet.function.DistributedComparator in project hazelcast-jet by hazelcast.

the class DistributedComparatorsTest method nullsLast_withoutWrapped.

@Test
public void nullsLast_withoutWrapped() {
    DistributedComparator c = nullsLast(null);
    assertEquals(0, c.compare(1, 2));
    assertEquals(0, c.compare(2, 1));
    assertEquals(-1, c.compare(0, null));
    assertEquals(1, c.compare(null, 0));
}
Also used : DistributedComparator(com.hazelcast.jet.function.DistributedComparator) Test(org.junit.Test)

Example 4 with DistributedComparator

use of com.hazelcast.jet.function.DistributedComparator in project hazelcast-jet by hazelcast.

the class DistributedComparatorsTest method nullsLastComparator.

@Test
public void nullsLastComparator() {
    DistributedComparator c = nullsLast(NATURAL_ORDER);
    assertEquals(-1, c.compare(1, 2));
    assertEquals(1, c.compare(2, 1));
    assertEquals(-1, c.compare(0, null));
    assertEquals(1, c.compare(null, 0));
}
Also used : DistributedComparator(com.hazelcast.jet.function.DistributedComparator) Test(org.junit.Test)

Example 5 with DistributedComparator

use of com.hazelcast.jet.function.DistributedComparator in project hazelcast-jet by hazelcast.

the class DistributedComparatorsTest method reverseOrderComparator.

@Test
public void reverseOrderComparator() {
    DistributedComparator c = REVERSE_ORDER;
    assertEquals(1, c.compare(1, 2));
    assertEquals(-1, c.compare(2, 1));
}
Also used : DistributedComparator(com.hazelcast.jet.function.DistributedComparator) Test(org.junit.Test)

Aggregations

DistributedComparator (com.hazelcast.jet.function.DistributedComparator)5 Test (org.junit.Test)5