flink-runtime/src/test/java/org/apache/flink/runtime/state/StateBackendTestBase.java
/**
	 * Verify that an empty {@code MapState} yields {@code null}.
	 */
Verify that an empty  MapState yields  null.
Verify that an empty MapState yields null .
@Test
	public void testMapStateDefaultValue() throws Exception {
		AbstractKeyedStateBackend<Integer> backend = createKeyedBackend(IntSerializer.INSTANCE);
		MapStateDescriptor<String, String> kvId = new MapStateDescriptor<>("id", String.class, String.class);
		MapState<String, String> state = backend.getPartitionedState(
				VoidNamespace.INSTANCE,
				VoidNamespaceSerializer.INSTANCE, kvId);
		backend.setCurrentKey(1);
		assertNull(state.entries());
		state.put("Ciao", "Hello");
		state.put("Bello", "Nice");
		assertNotNull(state.entries());
		assertEquals(state.get("Ciao"), "Hello");
		assertEquals(state.get("Bello"), "Nice");
		state.clear();
		assertNull(state.entries());
		backend.dispose();
	}
@ Test public void testMapStateDefaultValue ( ) throws Exception { AbstractKeyedStateBackend < Integer > backend = createKeyedBackend ( IntSerializer . INSTANCE ) ; MapStateDescriptor < String , String > kvId = new MapStateDescriptor < > ( "id" , String . class , String . class ) ; MapState < String , String > state = backend . getPartitionedState ( VoidNamespace . INSTANCE , VoidNamespaceSerializer . INSTANCE , kvId ) ; backend . setCurrentKey ( 1 ) ; assertNull ( state . entries ( ) ) ; state . put ( "Ciao" , "Hello" ) ; state . put ( "Bello" , "Nice" ) ; assertNotNull ( state . entries ( ) ) ; assertEquals ( state . get ( "Ciao" ) , "Hello" ) ; assertEquals ( state . get ( "Bello" ) , "Nice" ) ; state . clear ( ) ; assertNull ( state . entries ( ) ) ; backend . dispose ( ) ; }
Verify that an empty {@code MapState} yields {@code null}.
Verify that an empty { @code MapState } yields { @code null } .