1 package org.robolectric.pluginapi.config; 2 3 import java.lang.reflect.Method; 4 import java.util.Collection; 5 import java.util.Map; 6 7 /** 8 * Strategy for configuring individual tests. 9 * 10 * @since 4.2 11 */ 12 public interface ConfigurationStrategy { 13 14 /** 15 * Determine the configuration for the given test class and method. 16 * 17 * <p>Since a method may be run on multiple test subclasses, {@code testClass} indicates which 18 * test case is currently being evaluated. 19 * 20 * @param testClass the test class being evaluated; this might be a subclass of the method's 21 * declaring class. 22 * @param method the test method to be evaluated 23 * @return the set of configs 24 */ getConfig(Class<?> testClass, Method method)25 Configuration getConfig(Class<?> testClass, Method method); 26 27 /** 28 * Heterogeneous typesafe collection of configuration objects managed by their {@link Configurer}. 29 * 30 * @since 4.2 31 */ 32 interface Configuration { 33 34 /** Returns the configuration instance of the specified class for the current test. */ get(Class<T> configClass)35 <T> T get(Class<T> configClass); 36 37 /** Returns the set of known configuration classes. */ keySet()38 Collection<Class<?>> keySet(); 39 40 /** Returns the map of known configuration classes to configuration instances. */ map()41 Map<Class<?>, Object> map(); 42 } 43 } 44