AnnotatedLifecycleMethodStrategy implements LifecycleMethodStrategy { @Override public void invokeInitializeMethods(Object o) { final Class<?> aClass = o.getClass(); Method[] initMethods = null; try { initMethods = initializeMethodsCache.get(aClass); } catch (ExecutionException e) { Throwables.propagate(e); } if (initMethods != null && initMethods.length > 0) { doInvokeLifecycleMethods(o, initMethods); } } AnnotatedLifecycleMethodStrategy(); @Override void invokeInitializeMethods(Object o); @Override void invokeDestroyMethods(Object o);  }
@Test public void wrapsRuntimeExceptionThrownByInitMethodWithInternalException() { thrown.expect(lifecycleMethodInvocationExceptionMatcher("init fails")); lifecycleMethodStrategy.invokeInitializeMethods(new LifeCycleMethodsThrowsRuntimeException()); }
@Test public void invokesInitializeMethods() throws Exception { lifecycleMethodStrategy.invokeInitializeMethods(new WithLifeCycleAnnotation()); assertTrue(String.format("Only \"init\" and \"nonPublicInit\" methods are expected to be invoked but %s were invoked", callAssertion), callAssertion.size() == 2 && callAssertion.containsAll(newArrayList("init", "nonPublicInit"))); }