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());
}
Aggregations