/** * Finds the configuration methods based on the configured {@link ConfigurationStrategy}. * * @return collection of configuration methods (cannot be null but can be empty) * @throws Exception - If test instance cannot be created - Re-thrown while finding the * configuration methods */ protected Collection<JUnit4ConfigMethod> getConfigurationMethods() throws Exception { final Object testInstance = m_testClass.getJavaClass().newInstance(); ConfigurationStrategy configStrategy = m_testClass.getJavaClass().getAnnotation(ConfigurationStrategy.class); if (configStrategy == null) { configStrategy = DefaultConfigurationStrategy.class.getAnnotation(ConfigurationStrategy.class); } final Class<? extends JUnit4ConfigMethods>[] configMethodsClasses = configStrategy.value(); final List<JUnit4ConfigMethod> configMethods = new ArrayList<JUnit4ConfigMethod>(); for (final Class<? extends JUnit4ConfigMethods> configMethodsClass : configMethodsClasses) { final Collection<? extends JUnit4ConfigMethod> methods = configMethodsClass.newInstance().getConfigMethods(m_testClass, testInstance); if (methods != null) { configMethods.addAll(methods); } } Configuration profileConfiguration = m_testClass.getJavaClass().getAnnotation(Configuration.class); if (profileConfiguration != null) { for (final Class<? extends CompositeOption> options : profileConfiguration.extend()) { configMethods.add( new JUnit4ConfigMethod() { public boolean matches(Method testMethod) { // match all return true; } public Option[] getOptions() throws Exception { return options.newInstance().getOptions(); } }); } } return configMethods; }