Search in sources :

Example 1 with TestPersistentBean

use of org.jaffa.beans.factory.config.TestPersistentBean in project jaffa-framework by jaffa-projects.

the class PersistentConfigTest method testFallBackToPersistent.

/**
 * Test add fallback pattern to the static context causes the class to initialize
 */
@Test
public void testFallBackToPersistent() throws PreAddFailedException, NoSuchFieldException, IllegalAccessException {
    TestPersistentBean persistent = StaticContext.configure(new TestPersistentBean());
    Field f = persistent.getClass().getSuperclass().getDeclaredField("validator");
    f.setAccessible(true);
    Validator validator = (Validator) f.get(persistent);
    assertNotNull("bean should be initialized without a config for TestPersistentBean", validator);
}
Also used : Field(java.lang.reflect.Field) TestPersistentBean(org.jaffa.beans.factory.config.TestPersistentBean) Validator(org.jaffa.rules.fieldvalidators.Validator) Test(org.junit.Test)

Aggregations

Field (java.lang.reflect.Field)1 TestPersistentBean (org.jaffa.beans.factory.config.TestPersistentBean)1 Validator (org.jaffa.rules.fieldvalidators.Validator)1 Test (org.junit.Test)1