Search in sources :

Example 1 with TestDuplicateSerializer

use of org.apache.flink.runtime.state.heap.TestDuplicateSerializer in project flink by apache.

the class LockableTypeSerializerTest method testDuplicate.

/**
 * This tests that {@link Lockable.LockableTypeSerializer#duplicate()} works as expected.
 */
@Test
public void testDuplicate() {
    IntSerializer nonDuplicatingInnerSerializer = IntSerializer.INSTANCE;
    Assert.assertSame(nonDuplicatingInnerSerializer, nonDuplicatingInnerSerializer.duplicate());
    Lockable.LockableTypeSerializer<Integer> candidateTestShallowDuplicate = new Lockable.LockableTypeSerializer<>(nonDuplicatingInnerSerializer);
    Assert.assertSame(candidateTestShallowDuplicate, candidateTestShallowDuplicate.duplicate());
    TestDuplicateSerializer duplicatingInnerSerializer = new TestDuplicateSerializer();
    Assert.assertNotSame(duplicatingInnerSerializer, duplicatingInnerSerializer.duplicate());
    Lockable.LockableTypeSerializer<Integer> candidateTestDeepDuplicate = new Lockable.LockableTypeSerializer<>(duplicatingInnerSerializer);
    Lockable.LockableTypeSerializer<Integer> deepDuplicate = candidateTestDeepDuplicate.duplicate();
    Assert.assertNotSame(candidateTestDeepDuplicate, deepDuplicate);
    Assert.assertNotSame(candidateTestDeepDuplicate.getElementSerializer(), deepDuplicate.getElementSerializer());
}
Also used : IntSerializer(org.apache.flink.api.common.typeutils.base.IntSerializer) TestDuplicateSerializer(org.apache.flink.runtime.state.heap.TestDuplicateSerializer) Test(org.junit.Test)

Aggregations

IntSerializer (org.apache.flink.api.common.typeutils.base.IntSerializer)1 TestDuplicateSerializer (org.apache.flink.runtime.state.heap.TestDuplicateSerializer)1 Test (org.junit.Test)1