use of uk.gov.gchq.koryphe.impl.function.ToLowerCase in project Gaffer by gchq.
the class IfIT method shouldRunOtherwiseOperationsWhenConditionIsFalse.
@Test
public void shouldRunOtherwiseOperationsWhenConditionIsFalse() throws OperationException {
// Given
final If<Object, Object> ifOperation = new If<>();
ifOperation.setInput(INPUT_CAMEL_CASE);
ifOperation.setConditional(new Conditional(new IsA("java.lang.Integer")));
ifOperation.setThen(new Map<>(Lists.newArrayList(new ToUpperCase(), new ToList())));
ifOperation.setOtherwise(new Map<>(Lists.newArrayList(new ToLowerCase(), new ToList())));
// When
final Object output = graph.execute(ifOperation, getUser());
// Then
assertThat(output).isEqualTo(Lists.newArrayList(INPUT_CAMEL_CASE.toLowerCase())).isInstanceOf(List.class);
}
use of uk.gov.gchq.koryphe.impl.function.ToLowerCase in project Gaffer by gchq.
the class IfIT method shouldDoOtherwiseWhenConditionIsFalseAndNoThenOperation.
@Test
public void shouldDoOtherwiseWhenConditionIsFalseAndNoThenOperation() throws OperationException {
// Given
final If<Object, Object> ifOperation = new If<>();
ifOperation.setInput(INPUT_CAMEL_CASE);
ifOperation.setConditional(new Conditional(new IsA("java.lang.Integer")));
ifOperation.setOtherwise(new Map<>(Lists.newArrayList(new ToLowerCase(), new ToList())));
// When
final Object output = graph.execute(ifOperation, getUser());
// Then
assertThat(output).isEqualTo(Lists.newArrayList(INPUT_CAMEL_CASE.toLowerCase())).isInstanceOf(List.class);
}
use of uk.gov.gchq.koryphe.impl.function.ToLowerCase in project Gaffer by gchq.
the class IfIT method shouldRunThenOperationWhenConditionIsTrue.
@Test
public void shouldRunThenOperationWhenConditionIsTrue() throws OperationException {
// Given
final If<Object, Object> ifOperation = new If<>();
ifOperation.setInput(INPUT_CAMEL_CASE);
ifOperation.setConditional(new Conditional(new IsA("java.lang.String")));
ifOperation.setThen(new Map<>(Lists.newArrayList(new ToUpperCase(), new ToList())));
ifOperation.setOtherwise(new Map<>(Lists.newArrayList(new ToLowerCase(), new ToList())));
// When
final Object output = graph.execute(ifOperation, getUser());
// Then
assertThat(output).isEqualTo(Lists.newArrayList(INPUT_CAMEL_CASE.toUpperCase())).isInstanceOf(List.class);
}
Aggregations