flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-runtime/src/test/java/org/apache/flink/runtime/state/StateBackendTestBase.java
/**
	 * Verify that an empty {@code FoldingState} yields {@code null}.
	 */
Verify that an empty  FoldingState yields  null.
Verify that an empty FoldingState yields null .
@Test
	public void testFoldingStateDefaultValue() throws Exception {
		AbstractKeyedStateBackend<Integer> backend = createKeyedBackend(IntSerializer.INSTANCE);
		FoldingStateDescriptor<Integer, String> kvId =
				new FoldingStateDescriptor<>("id", "Fold-Initial:", new AppendingFold(), String.class);
		FoldingState<Integer, String> state = backend.getPartitionedState(
				VoidNamespace.INSTANCE,
				VoidNamespaceSerializer.INSTANCE, kvId);
		backend.setCurrentKey(1);
		assertNull(state.get());
		state.add(1);
		state.add(2);
		assertEquals("Fold-Initial:,1,2", state.get());
		state.clear();
		assertNull(state.get());
		backend.dispose();
	}
@ Test public void testFoldingStateDefaultValue ( ) throws Exception { AbstractKeyedStateBackend < Integer > backend = createKeyedBackend ( IntSerializer . INSTANCE ) ; FoldingStateDescriptor < Integer , String > kvId = new FoldingStateDescriptor < > ( "id" , "Fold-Initial:" , new AppendingFold ( ) , String . class ) ; FoldingState < Integer , String > state = backend . getPartitionedState ( VoidNamespace . INSTANCE , VoidNamespaceSerializer . INSTANCE , kvId ) ; backend . setCurrentKey ( 1 ) ; assertNull ( state . get ( ) ) ; state . add ( 1 ) ; state . add ( 2 ) ; assertEquals ( "Fold-Initial:,1,2" , state . get ( ) ) ; state . clear ( ) ; assertNull ( state . get ( ) ) ; backend . dispose ( ) ; }
Verify that an empty {@code FoldingState} yields {@code null}.
Verify that an empty { @code FoldingState } yields { @code null } .