### Question:
RunViaAnnotationDriverFinder implements DriverFinder { @Override public Driver findTestClassDriver(Class<?> testClass) { RunVia annotation = testClass.getAnnotation(RunVia.class); if (annotation == null) { return DRIVER_NOT_FOUND; } Class<? extends Driver> driverClass = annotation.value(); try { return driverClass.newInstance(); } catch (Exception e) { throw new RuntimeException("unable to instantiate " + driverClass, e); } }  @Override Driver findTestClassDriver(Class<?> testClass);  }### Answer:
@Test public void instantiates_the_driver_specified_in_the_RunVia_annotation() { Driver driver = driverFinder.findTestClassDriver(DummyTestClass.class); assertThat(driver, is(instanceOf(DummyDriver.class))); }
@Test public void the_RunVia_annotation_is_inherited_from_super_class() { Driver driver = driverFinder.findTestClassDriver(InheritsAnnotationFromSuperClass.class); assertThat(driver, is(instanceOf(DummyDriver.class))); }
@Test public void does_not_support_classes_that_are_not_annotated_with_RunVia() { Driver driver = driverFinder.findTestClassDriver(NotAnnotatedClass.class); assertThat(driver, is(DriverFinder.DRIVER_NOT_FOUND)); }