use of uk.gov.gchq.gaffer.function.IsA in project Gaffer by gchq.
the class NotTest method shouldJsonSerialiseAndDeserialise.
@Test
public void shouldJsonSerialiseAndDeserialise() throws SerialisationException {
// Given
final IsA isA = new IsA(String.class);
final Not filter = new Not(isA);
// When
final String json = new String(new JSONSerialiser().serialise(filter, true));
// Then
JsonUtil.assertEquals(String.format("{%n" + " \"class\" : \"uk.gov.gchq.gaffer.function.filter.Not\",%n" + " \"function\" : {%n" + " \"class\" : \"uk.gov.gchq.gaffer.function.IsA\",%n" + " \"type\" : \"java.lang.String\"%n" + " }%n" + "}"), json);
// When 2
final Not deserialisedFilter = new JSONSerialiser().deserialise(json.getBytes(), Not.class);
// Then 2
assertNotNull(deserialisedFilter);
assertEquals(String.class.getName(), ((IsA) deserialisedFilter.getFunction()).getType());
}
use of uk.gov.gchq.gaffer.function.IsA in project Gaffer by gchq.
the class IsAExample method isAString.
public void isAString() {
// ---------------------------------------------------------
final IsA function = new IsA(String.class);
// ---------------------------------------------------------
runExample(function, 1, 2.5, "abc");
}
use of uk.gov.gchq.gaffer.function.IsA in project Gaffer by gchq.
the class IsAExample method isANumber.
public void isANumber() {
// ---------------------------------------------------------
final IsA function = new IsA(Number.class);
// ---------------------------------------------------------
runExample(function, 1, 2.5, "abc");
}
Aggregations