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(); ...

Get Developing Java Applications with Spring and Spring Boot now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.