use of uk.gov.gchq.gaffer.operation.io.InputOutput in project Gaffer by gchq.
the class ForEachHandlerTest method shouldExecuteAndReturnExpected.
@Test
public void shouldExecuteAndReturnExpected() throws OperationException {
// Given
final Store store = mock(Store.class);
final Context context = new Context(new User());
final InputOutput op = mock(InputOutput.class);
final InputOutput opClone = mock(InputOutput.class);
given(op.shallowClone()).willReturn(opClone);
final Object input = mock(Object.class);
final Object output = mock(Object.class);
final ForEach forEach = new ForEach.Builder<>().input(input).operation(op).build();
final ForEachHandler handler = new ForEachHandler();
given(store.execute(opClone, context)).willReturn(output);
// When
final List<Object> result = (List<Object>) handler.doOperation(forEach, context, store);
// Then
verify(opClone).setInput(input);
assertThat(result).hasSize(1);
assertSame(output, result.get(0));
}
Aggregations