flink-runtime/src/test/java/org/apache/flink/runtime/state/StateBackendTestBase.java
/**
	 * Verify that an empty {@code ValueState} will yield the default value.
	 */
Verify that an empty  ValueState will yield the default value.
Verify that an empty ValueState will yield the default value .
@Test
	public void testValueStateDefaultValue() throws Exception {
		AbstractKeyedStateBackend<Integer> backend = createKeyedBackend(IntSerializer.INSTANCE);
		ValueStateDescriptor<String> kvId = new ValueStateDescriptor<>("id", String.class, "Hello");
		ValueState<String> state = backend.getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, kvId);
		backend.setCurrentKey(1);
		assertEquals("Hello", state.value());
		state.update("Ciao");
		assertEquals("Ciao", state.value());
		state.clear();
		assertEquals("Hello", state.value());
		backend.dispose();
	}
@ Test public void testValueStateDefaultValue ( ) throws Exception { AbstractKeyedStateBackend < Integer > backend = createKeyedBackend ( IntSerializer . INSTANCE ) ; ValueStateDescriptor < String > kvId = new ValueStateDescriptor < > ( "id" , String . class , "Hello" ) ; ValueState < String > state = backend . getPartitionedState ( VoidNamespace . INSTANCE , VoidNamespaceSerializer . INSTANCE , kvId ) ; backend . setCurrentKey ( 1 ) ; assertEquals ( "Hello" , state . value ( ) ) ; state . update ( "Ciao" ) ; assertEquals ( "Ciao" , state . value ( ) ) ; state . clear ( ) ; assertEquals ( "Hello" , state . value ( ) ) ; backend . dispose ( ) ; }
Verify that an empty {@code ValueState} will yield the default value.
Verify that an empty { @code ValueState } will yield the default value .