Search in sources :

Example 6 with Max

use of uk.gov.gchq.gaffer.operation.impl.compare.Max in project Gaffer by gchq.

the class MaxHandlerTest method shouldReturnNullIfBothComparatorsAreNull.

@Test
public void shouldReturnNullIfBothComparatorsAreNull() throws OperationException {
    // Given
    final List<Entity> input = Lists.newArrayList();
    final Max max = new Max.Builder().input(input).build();
    final MaxHandler handler = new MaxHandler();
    // When
    final Element result = handler.doOperation(max, null, null);
    // Then
    assertNull(result);
}
Also used : Entity(uk.gov.gchq.gaffer.data.element.Entity) Max(uk.gov.gchq.gaffer.operation.impl.compare.Max) Element(uk.gov.gchq.gaffer.data.element.Element) Test(org.junit.jupiter.api.Test)

Example 7 with Max

use of uk.gov.gchq.gaffer.operation.impl.compare.Max in project Gaffer by gchq.

the class MaxHandlerTest method shouldReturnNullIfOperationInputIsNull.

@Test
public void shouldReturnNullIfOperationInputIsNull() throws OperationException {
    // Given
    final Max max = new Max.Builder().build();
    final MaxHandler handler = new MaxHandler();
    // When
    final Element result = handler.doOperation(max, null, null);
    // Then
    assertNull(result);
}
Also used : Max(uk.gov.gchq.gaffer.operation.impl.compare.Max) Element(uk.gov.gchq.gaffer.data.element.Element) Test(org.junit.jupiter.api.Test)

Example 8 with Max

use of uk.gov.gchq.gaffer.operation.impl.compare.Max in project Gaffer by gchq.

the class AbstractExamplesFactoryTest method shouldUseSchemaForMaxOperation.

@Test
public void shouldUseSchemaForMaxOperation() throws InstantiationException, IllegalAccessException {
    // Given
    TestExamplesFactory examplesFactory = new TestExamplesFactory(SCHEMA);
    // When
    Max operation = (Max) examplesFactory.generateExample(Max.class);
    // Then
    // Max has no equals method
    assertEquals(1, operation.getComparators().size());
    assertEquals(Sets.newHashSet("BasicEdge"), ((ElementPropertyComparator) operation.getComparators().get(0)).getGroups());
    assertEquals("count", ((ElementPropertyComparator) operation.getComparators().get(0)).getProperty());
}
Also used : Max(uk.gov.gchq.gaffer.operation.impl.compare.Max) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)8 Max (uk.gov.gchq.gaffer.operation.impl.compare.Max)8 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)4 Store (uk.gov.gchq.gaffer.store.Store)1 Schema (uk.gov.gchq.gaffer.store.schema.Schema)1 ViewValidator (uk.gov.gchq.gaffer.store.schema.ViewValidator)1 ValidationResult (uk.gov.gchq.koryphe.ValidationResult)1