Search in sources :

Example 1 with NthItem

use of uk.gov.gchq.koryphe.impl.function.NthItem in project Gaffer by gchq.

the class MapHandlerTest method shouldReturnIterableFromOperation.

@Test
public void shouldReturnIterableFromOperation() throws OperationException {
    // Given
    final Iterable<Iterable<Integer>> input = Arrays.asList(Arrays.asList(1, 2, 3), Arrays.asList(4, 5, 6), Arrays.asList(7, 8, 9));
    final MapHandler<Iterable<Iterable<Integer>>, String> handler = new MapHandler<>();
    final Map<Iterable<Iterable<Integer>>, String> operation = new Map.Builder<Iterable<Iterable<Integer>>>().input(input).first(new IterableFunction.Builder<Iterable<Integer>>().first(new NthItem<>(1)).then(Object::toString).build()).then(new NthItem<>(2)).build();
    // When
    final String results = handler.doOperation(operation, context, store);
    // Then
    assertNotNull(results);
    assertEquals("8", results);
}
Also used : NthItem(uk.gov.gchq.koryphe.impl.function.NthItem) ToString(uk.gov.gchq.koryphe.impl.function.ToString) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 NthItem (uk.gov.gchq.koryphe.impl.function.NthItem)1 ToString (uk.gov.gchq.koryphe.impl.function.ToString)1