Search in sources :

Example 6 with Min

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);
}
Also used : Min(uk.gov.gchq.gaffer.operation.impl.compare.Min) Element(uk.gov.gchq.gaffer.data.element.Element) Test(org.junit.jupiter.api.Test)

Example 7 with Min

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);
}
Also used : Entity(uk.gov.gchq.gaffer.data.element.Entity) Min(uk.gov.gchq.gaffer.operation.impl.compare.Min) Element(uk.gov.gchq.gaffer.data.element.Element) ElementPropertyComparator(uk.gov.gchq.gaffer.data.element.comparison.ElementPropertyComparator) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)7 Min (uk.gov.gchq.gaffer.operation.impl.compare.Min)7 Element (uk.gov.gchq.gaffer.data.element.Element)6 Entity (uk.gov.gchq.gaffer.data.element.Entity)5 ElementPropertyComparator (uk.gov.gchq.gaffer.data.element.comparison.ElementPropertyComparator)3