public static <T extends AbstractConfiguration> T findConfiguration(Class<?> klass) {
		// Look for static methods first
		List<Method> methods = findStaticMethodsAnnotatedWith(klass, TestServerConfiguration.class);
		List<Field> fields = findStaticFieldsAnnotatedWith(klass, TestServerConfiguration.class);
		int nbOfConfigurations = methods.size() + fields.size();

		if (nbOfConfigurations > 1) {
			failBecauseOfDuplicateConfiguration(klass, methods, fields);
		}

		if (!methods.isEmpty()) {
			return invoke(methods.get(0));
		}

		// Then, look for static field
		if (!fields.isEmpty()) {
			return getter(fields.get(0));
		}

		return null;
	}
public static <T extends AbstractConfiguration> T findConfiguration(Class<?> klass) {
		
		List<Method> methods = findStaticMethodsAnnotatedWith(klass, TestServerConfiguration.class);
		List<Field> fields = findStaticFieldsAnnotatedWith(klass, TestServerConfiguration.class);
		int nbOfConfigurations = methods.size() + fields.size();

		if (nbOfConfigurations > 1) {
			failBecauseOfDuplicateConfiguration(klass, methods, fields);
		}

		if (!methods.isEmpty()) {
			return invoke(methods.get(0));
		}

		
		if (!fields.isEmpty()) {
			return getter(fields.get(0));
		}

		return null;
	}
public static < T extends AbstractConfiguration > T findConfiguration ( Class < ? > klass ) { // Look for static methods first List < Method > methods = findStaticMethodsAnnotatedWith ( klass , TestServerConfiguration . class ) ; List < Field > fields = findStaticFieldsAnnotatedWith ( klass , TestServerConfiguration . class ) ; int nbOfConfigurations = methods . size ( ) + fields . size ( ) ; if ( nbOfConfigurations > 1 ) { failBecauseOfDuplicateConfiguration ( klass , methods , fields ) ; } if ( ! methods . isEmpty ( ) ) { return invoke ( methods . get ( 0 ) ) ; } // Then, look for static field if ( ! fields . isEmpty ( ) ) { return getter ( fields . get ( 0 ) ) ; } return null ; }
Find configuration object on static field / method on
running class. Configuration is read from static method or static field
annotated with {@link com.github.mjeanroy.junit.servers.annotations.TestServerConfiguration} annotation.

@param klass Class to inspect.
@param <T> Type of configuration.
@return Configuration.
Find configuration object on static field / method on running class . Configuration is read from static method or static field annotated with { @link com . github . mjeanroy . junit . servers . annotations . TestServerConfiguration } annotation .