use of uk.gov.gchq.gaffer.operation.impl.compare.Min in project Gaffer by gchq.
the class MinHandlerTest method shouldReturnNullIfOperationInputIsNull.
@Test
public void shouldReturnNullIfOperationInputIsNull() throws OperationException {
// Given
final Min min = new Min.Builder().build();
final MinHandler handler = new MinHandler();
// When
final Element result = handler.doOperation(min, null, null);
// Then
assertNull(result);
}
use of uk.gov.gchq.gaffer.operation.impl.compare.Min in project Gaffer by gchq.
the class MinHandlerTest method shouldFindMinBasedOnMultipleProperties.
@Test
public void shouldFindMinBasedOnMultipleProperties() throws OperationException {
// Given
final Entity entity1 = makeEntity(1, 1);
final Entity entity2 = makeEntity(1, 2);
final Entity entity3 = makeEntity(2, 2);
final Entity entity4 = makeEntity(2, 1);
final List<Entity> input = Lists.newArrayList(entity1, entity2, entity3, entity4);
final Min min = new Min.Builder().input(input).comparators(new ElementPropertyComparator.Builder().groups(TestGroups.ENTITY).property("property1").build(), new ElementPropertyComparator.Builder().groups(TestGroups.ENTITY).property("property2").build()).build();
final MinHandler handler = new MinHandler();
// When
final Element result = handler.doOperation(min, null, null);
// Then
assertSame(entity1, result);
}
Aggregations