Search in sources :

Example 1 with Or

use of uk.gov.gchq.koryphe.impl.binaryoperator.Or in project Gaffer by gchq.

the class AggregateHandlerTest method shouldFailValidationWhenTypeArgumentOfBinaryOperatorInFunctionIsIncorrect.

@Test
public void shouldFailValidationWhenTypeArgumentOfBinaryOperatorInFunctionIsIncorrect() {
    // Given
    final Schema schema = new Schema.Builder().entity(TestGroups.ENTITY, new SchemaEntityDefinition.Builder().property(TestPropertyNames.TIMESTAMP, "timestamp.long").build()).type("timestamp.long", new TypeDefinition(Long.class)).build();
    given(store.getSchema()).willReturn(schema);
    input.add(entity);
    input.add(entity1);
    input.add(entity2);
    entities.put(TestGroups.ENTITY, new AggregatePair(new ElementAggregator.Builder().select(TestPropertyNames.TIMESTAMP).execute(new Or()).build()));
    final Aggregate aggregate = new Aggregate.Builder().input(input).entities(entities).build();
    // When / Then
    assertThatExceptionOfType(OperationException.class).isThrownBy(() -> handler.doOperation(aggregate, context, store)).withMessageContaining("Incompatible types.");
}
Also used : Or(uk.gov.gchq.koryphe.impl.binaryoperator.Or) Schema(uk.gov.gchq.gaffer.store.schema.Schema) AggregatePair(uk.gov.gchq.gaffer.operation.util.AggregatePair) SchemaEntityDefinition(uk.gov.gchq.gaffer.store.schema.SchemaEntityDefinition) Aggregate(uk.gov.gchq.gaffer.operation.impl.function.Aggregate) TypeDefinition(uk.gov.gchq.gaffer.store.schema.TypeDefinition) ElementAggregator(uk.gov.gchq.gaffer.data.element.function.ElementAggregator) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 ElementAggregator (uk.gov.gchq.gaffer.data.element.function.ElementAggregator)1 Aggregate (uk.gov.gchq.gaffer.operation.impl.function.Aggregate)1 AggregatePair (uk.gov.gchq.gaffer.operation.util.AggregatePair)1 Schema (uk.gov.gchq.gaffer.store.schema.Schema)1 SchemaEntityDefinition (uk.gov.gchq.gaffer.store.schema.SchemaEntityDefinition)1 TypeDefinition (uk.gov.gchq.gaffer.store.schema.TypeDefinition)1 Or (uk.gov.gchq.koryphe.impl.binaryoperator.Or)1