@SuppressWarnings("serial") @Test @SpecAssertion(section = MEMBER_LEVEL_INHERITANCE, id = "g") public void testObserverResolution() throws Exception { Set<ObserverMethod<? super Qux>> observerMethods = getCurrentManager().resolveObserverMethods(new Qux(null)); assertEquals(observerMethods.size(), 1); ObserverMethod<? super Qux> observerMethod = observerMethods.iterator().next(); assertEquals(observerMethod.getBeanClass(), Foo.class); assertEquals(observerMethod.getObservedType(), new TypeLiteral<Baz<String>>() { }.getType()); }
@SuppressWarnings("serial") @Test @SpecAssertion(section = MEMBER_LEVEL_INHERITANCE, id = "f") public void testInjectionPointDefinition() throws Exception { Bean<Foo> fooBean = getUniqueBean(Foo.class); Set<InjectionPoint> injectionPoints = fooBean.getInjectionPoints(); // Baz<T1> baz, T1 t1, Baz<List<T2>> t2BazList, T1[] t1Array assertEquals(injectionPoints.size(), 4); for (InjectionPoint injectionPoint : injectionPoints) { if ("baz".equals(injectionPoint.getMember().getName())) { assertEquals(injectionPoint.getType(), new TypeLiteral<Baz<String>>() { }.getType()); } else if ("t1".equals(injectionPoint.getMember().getName())) { assertEquals(injectionPoint.getType(), String.class); } else if ("t2BazList".equals(injectionPoint.getMember().getName())) { assertEquals(injectionPoint.getType(), new TypeLiteral<Baz<List<Qux>>>() { }.getType()); } else if ("setT1Array".equals(injectionPoint.getMember().getName())) { // Initializer IP assertEquals(injectionPoint.getType(), String[].class); } else { fail("Unexpected injection point"); } } }
@Test(dataProvider = ARQUILLIAN_DATA_PROVIDER) @SpecAssertion(section = MEMBER_LEVEL_INHERITANCE, id = "g") public void testObserver(Foo foo) throws Exception { assertNotNull(foo); getCurrentManager().fireEvent(new Qux(null)); assertNotNull(foo.getT1BazEvent()); assertEquals(foo.getT1ObserverInjectionPoint(), "ok"); }