Testing your custom Spring Boot autoconfiguration
If picking between several WebDriver
implementations sounds hokey and unnecessarily complicated, then let's do what Spring Boot does best: autoconfigure it!
Okay, if we're going to autoconfigure something, we sure as heck want to test what we're doing. That way, we can make sure it performs as expected. To do so requires a little bit of test setup. Check it out:
public class WebDriverAutoConfigurationTests { private AnnotationConfigApplicationContext context; @After public void close() { if (this.context != null) { this.context.close(); } } private void load(Class<?>[] configs, String... environment) { AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); applicationContext .register(WebDriverAutoConfiguration.class); if (configs.length > 0) { applicationContext...