Search in sources :

Example 21 with TypeSubTypeValue

use of uk.gov.gchq.gaffer.types.TypeSubTypeValue in project Gaffer by gchq.

the class TypeSubTypeValueToTupleTest method shouldGetAndSetUsingCompositeFunction.

@Test
public void shouldGetAndSetUsingCompositeFunction() {
    // Given
    final TypeSubTypeValue typeSubTypeValue = new TypeSubTypeValue("type", "subType", "value");
    final Function<Object, Object> compositeFunction = new FunctionComposite(Lists.newArrayList(new TypeSubTypeValueToTuple(), new TupleAdaptedFunctionComposite.Builder().select(new String[] { "value" }).execute(new FunctionComposite(Arrays.asList(new Length(), new ToString()))).project(new String[] { "type" }).build()));
    // When
    compositeFunction.apply(typeSubTypeValue);
    // Then
    assertEquals(new TypeSubTypeValue("5", "subType", "value"), typeSubTypeValue);
}
Also used : Length(uk.gov.gchq.koryphe.impl.function.Length) TypeSubTypeValue(uk.gov.gchq.gaffer.types.TypeSubTypeValue) ToString(uk.gov.gchq.koryphe.impl.function.ToString) ToString(uk.gov.gchq.koryphe.impl.function.ToString) TupleAdaptedFunctionComposite(uk.gov.gchq.koryphe.tuple.function.TupleAdaptedFunctionComposite) FunctionComposite(uk.gov.gchq.koryphe.function.FunctionComposite) FunctionTest(uk.gov.gchq.koryphe.function.FunctionTest) Test(org.junit.jupiter.api.Test)

Aggregations

TypeSubTypeValue (uk.gov.gchq.gaffer.types.TypeSubTypeValue)21 Test (org.junit.jupiter.api.Test)18 FunctionTest (uk.gov.gchq.koryphe.function.FunctionTest)6 OperationTest (uk.gov.gchq.gaffer.operation.OperationTest)2 EntitySeed (uk.gov.gchq.gaffer.operation.data.EntitySeed)2 FunctionComposite (uk.gov.gchq.koryphe.function.FunctionComposite)2 ToString (uk.gov.gchq.koryphe.impl.function.ToString)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Pair (uk.gov.gchq.gaffer.commonutil.pair.Pair)1 SerialisationException (uk.gov.gchq.gaffer.exception.SerialisationException)1 CallMethod (uk.gov.gchq.koryphe.impl.function.CallMethod)1 DivideBy (uk.gov.gchq.koryphe.impl.function.DivideBy)1 FirstItem (uk.gov.gchq.koryphe.impl.function.FirstItem)1 Length (uk.gov.gchq.koryphe.impl.function.Length)1 ToInteger (uk.gov.gchq.koryphe.impl.function.ToInteger)1 ToLong (uk.gov.gchq.koryphe.impl.function.ToLong)1 TupleAdaptedFunctionComposite (uk.gov.gchq.koryphe.tuple.function.TupleAdaptedFunctionComposite)1