flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-core/src/test/java/org/apache/flink/api/common/state/AggregatingStateDescriptorTest.java
/**
	 * FLINK-6775
	 *
	 * Tests that the returned serializer is duplicated. This allows to
	 * share the state descriptor.
	 */
FLINK-6775
Tests that the returned serializer is duplicated. This allows to
share the state descriptor.
FLINK - 6775 Tests that the returned serializer is duplicated . This allows to share the state descriptor .
@SuppressWarnings("unchecked")
	@Test
	public void testSerializerDuplication() {
		TypeSerializer<Long> serializer = mock(TypeSerializer.class);
		when(serializer.duplicate()).thenAnswer(new Answer<TypeSerializer<Long>>() {
			@Override
			public TypeSerializer<Long> answer(InvocationOnMock invocation) throws Throwable {
				return mock(TypeSerializer.class);
			}
		});
		AggregateFunction<Long, Long, Long> aggregatingFunction = mock(AggregateFunction.class);
		AggregatingStateDescriptor<Long, Long, Long> descr = new AggregatingStateDescriptor<>(
			"foobar",
			aggregatingFunction,
			serializer);
		TypeSerializer<Long> serializerA = descr.getSerializer();
		TypeSerializer<Long> serializerB = descr.getSerializer();
		assertNotSame(serializerA, serializerB);
	}
@ SuppressWarnings ( "unchecked" ) @ Test public void testSerializerDuplication ( ) { TypeSerializer < Long > serializer = mock ( TypeSerializer . class ) ; when ( serializer . duplicate ( ) ) . thenAnswer ( new Answer < TypeSerializer < Long > > ( ) { @ Override public TypeSerializer < Long > answer ( InvocationOnMock invocation ) throws Throwable { return mock ( TypeSerializer . class ) ; } } ) ; AggregateFunction < Long , Long , Long > aggregatingFunction = mock ( AggregateFunction . class ) ; AggregatingStateDescriptor < Long , Long , Long > descr = new AggregatingStateDescriptor < > ( "foobar" , aggregatingFunction , serializer ) ; TypeSerializer < Long > serializerA = descr . getSerializer ( ) ; TypeSerializer < Long > serializerB = descr . getSerializer ( ) ; assertNotSame ( serializerA , serializerB ) ; }
FLINK-6775
 Tests that the returned serializer is duplicated.
FLINK - 6775 Tests that the returned serializer is duplicated .
// check that the retrieved serializers are not the same