Search in sources :

Example 1 with SampleIdentifiedDataSerializable

use of com.hazelcast.nio.serialization.SampleIdentifiedDataSerializable in project hazelcast by hazelcast.

the class ArrayDataSerializableFactoryTest method testCreate.

@Test
public void testCreate() throws Exception {
    ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructorFunctions = new ConstructorFunction[1];
    constructorFunctions[0] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {

        @Override
        public IdentifiedDataSerializable createNew(Integer arg) {
            return new SampleIdentifiedDataSerializable();
        }
    };
    ArrayDataSerializableFactory factory = new ArrayDataSerializableFactory(constructorFunctions);
    assertNull(factory.create(-1));
    assertNull(factory.create(1));
    assertThat(factory.create(0), instanceOf(SampleIdentifiedDataSerializable.class));
}
Also used : IdentifiedDataSerializable(com.hazelcast.nio.serialization.IdentifiedDataSerializable) SampleIdentifiedDataSerializable(com.hazelcast.nio.serialization.SampleIdentifiedDataSerializable) SampleIdentifiedDataSerializable(com.hazelcast.nio.serialization.SampleIdentifiedDataSerializable) ConstructorFunction(com.hazelcast.util.ConstructorFunction) VersionAwareConstructorFunction(com.hazelcast.util.VersionAwareConstructorFunction) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

IdentifiedDataSerializable (com.hazelcast.nio.serialization.IdentifiedDataSerializable)1 SampleIdentifiedDataSerializable (com.hazelcast.nio.serialization.SampleIdentifiedDataSerializable)1 ParallelTest (com.hazelcast.test.annotation.ParallelTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 ConstructorFunction (com.hazelcast.util.ConstructorFunction)1 VersionAwareConstructorFunction (com.hazelcast.util.VersionAwareConstructorFunction)1 Test (org.junit.Test)1