@Test
public void testValueStateDescriptorLazySerializer() throws Exception {

	// some different registered value
	ExecutionConfig cfg = new ExecutionConfig();
	cfg.registerKryoType(TaskInfo.class);
	ListStateDescriptor<Path> descr =
			new ListStateDescriptor<Path>("testName", Path.class);
	
	try {
		descr.getSerializer();
		fail("should cause an exception");
	} catch (IllegalStateException ignored) {}
	descr.initializeSerializerUnlessSet(cfg);
	assertNotNull(descr.getSerializer());
	assertTrue(descr.getSerializer() instanceof ListSerializer);
	assertNotNull(descr.getElementSerializer());
	assertTrue(descr.getElementSerializer() instanceof KryoSerializer);
	assertTrue(((KryoSerializer<?>) descr.getElementSerializer()).getKryo().getRegistration(TaskInfo.class).getId() > 0);
}