assertInitialized();
doPostInitCalled.set(true);
}
};
SpringContextBootstrappingInitializer initializer = new SpringContextBootstrappingInitializer();
Properties parameters = createParameters("param", "value");
try {
declarable.init(parameters);
assertFalse(declarable.isInitialized());
assertFalse(doPostInitCalled.get());
assertSame(parameters, declarable.nullSafeGetParameters());
initializer.onApplicationEvent(new ContextRefreshedEvent(mockApplicationContext));
assertTrue(declarable.isInitialized());
assertTrue(doPostInitCalled.get());
declarable.assertEquals(parameters);
declarable.assertSame(mockBeanFactory);
declarable.destroy();
doPostInitCalled.set(false);
assertFalse(declarable.isInitialized());
assertFalse(doPostInitCalled.get());
assertNotSame(parameters, declarable.nullSafeGetParameters());
initializer.onApplicationEvent(new ContextRefreshedEvent(mockApplicationContext));
assertFalse(declarable.isInitialized());
assertFalse(doPostInitCalled.get());
}
finally {
initializer.onApplicationEvent(new ContextClosedEvent(mockApplicationContext));
}
}