Search in sources :

Example 6 with ConsumerFunction

use of uk.gov.gchq.gaffer.function.ConsumerFunction in project Gaffer by gchq.

the class ConsumerFunctionContextTest method shouldThrowExceptionWhenBuildContextWhenExecuteCalledTwice.

@Test
public void shouldThrowExceptionWhenBuildContextWhenExecuteCalledTwice() {
    // Given
    final String reference1 = "reference 1";
    final ConsumerFunction func1 = mock(ConsumerFunction.class);
    final ConsumerFunction func2 = mock(ConsumerFunction.class);
    // When / Then
    try {
        new ConsumerFunctionContext.Builder<String, ConsumerFunction>().select(reference1).execute(func1).execute(func2).build();
        fail("Exception expected");
    } catch (final IllegalStateException e) {
        assertNotNull(e);
    }
}
Also used : ConsumerFunction(uk.gov.gchq.gaffer.function.ConsumerFunction) Test(org.junit.Test)

Example 7 with ConsumerFunction

use of uk.gov.gchq.gaffer.function.ConsumerFunction in project Gaffer by gchq.

the class ConsumerFunctionContextTest method shouldThrowExceptionWhenBuildContextWhenSelectCalledTwice.

@Test
public void shouldThrowExceptionWhenBuildContextWhenSelectCalledTwice() {
    // Given
    final String reference1 = "reference 1";
    final String reference2 = "reference 2";
    final ConsumerFunction func1 = mock(ConsumerFunction.class);
    // When / Then
    try {
        new ConsumerFunctionContext.Builder<String, ConsumerFunction>().select(reference1).execute(func1).select(reference2).build();
        fail("Exception expected");
    } catch (final IllegalStateException e) {
        assertNotNull(e);
    }
}
Also used : ConsumerFunction(uk.gov.gchq.gaffer.function.ConsumerFunction) Test(org.junit.Test)

Aggregations

ConsumerFunction (uk.gov.gchq.gaffer.function.ConsumerFunction)7 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)2 IdentifierType (uk.gov.gchq.gaffer.data.element.IdentifierType)2 ConsumerFunctionContext (uk.gov.gchq.gaffer.function.context.ConsumerFunctionContext)2