use of uk.gov.gchq.gaffer.serialisation.implementation.raw.RawDateSerialiser in project Gaffer by gchq.
the class SerialisationFactoryTest method shouldReturnCustomSerialiserIfCustomSerialiserFound.
@Test
public void shouldReturnCustomSerialiserIfCustomSerialiserFound() throws SerialisationException {
// Given
final Serialiser[] serialisers = new Serialiser[] { new RawDateSerialiser(), new RawDoubleSerialiser(), new RawFloatSerialiser() };
final SerialisationFactory factory = new SerialisationFactory(serialisers);
final Class<?> clazz = Double.class;
// When
final Serialiser serialiser = factory.getSerialiser(clazz);
// Then
assertTrue(serialiser.canHandle(clazz));
assertEquals(RawDoubleSerialiser.class, serialiser.getClass());
}
use of uk.gov.gchq.gaffer.serialisation.implementation.raw.RawDateSerialiser in project Gaffer by gchq.
the class SerialisationFactoryTest method testAddSerialisers.
@Test
public void testAddSerialisers() throws SerialisationException {
// Given
final Serialiser[] serialisers = new Serialiser[] { new RawDateSerialiser(), new RawDoubleSerialiser(), new RawFloatSerialiser() };
final SerialisationFactory factory = new SerialisationFactory(serialisers);
final Class<?> clazz = String.class;
// When
factory.addSerialisers(new StringSerialiser());
Serialiser serialiser = factory.getSerialiser(clazz);
// Then
assertTrue(serialiser.canHandle(clazz));
assertEquals(StringSerialiser.class, serialiser.getClass());
}
use of uk.gov.gchq.gaffer.serialisation.implementation.raw.RawDateSerialiser in project Gaffer by gchq.
the class SerialisationFactoryTest method shouldReturnJavaSerialiserIfNoCustomSerialiserFound.
@Test
public void shouldReturnJavaSerialiserIfNoCustomSerialiserFound() throws SerialisationException {
// Given
final Serialiser[] serialisers = new Serialiser[] { new RawDateSerialiser(), new RawDoubleSerialiser(), new RawFloatSerialiser() };
final SerialisationFactory factory = new SerialisationFactory(serialisers);
final Class<?> clazz = String.class;
// When
final Serialiser serialiser = factory.getSerialiser(clazz);
// Then
assertTrue(serialiser.canHandle(clazz));
assertEquals(JavaSerialiser.class, serialiser.getClass());
}
Aggregations