...17import org.junit.platform.commons.util.PreconditionViolationException;18import org.junit.rules.ErrorCollector;19import org.junit.rules.TemporaryFolder;20import org.junit.rules.TestRule;21import org.junit.rules.Verifier;22/**23 * @since 5.024 */25public class AbstractTestRuleAdapterTests {26 @Test27 void constructionWithAssignableArgumentsIsSuccessful() {28 new TestableTestRuleAdapter(new SimpleRuleAnnotatedMember(new ErrorCollector()), Verifier.class);29 }30 @Test31 void constructionWithUnassignableArgumentsFails() {32 PreconditionViolationException exception = assertThrows(PreconditionViolationException.class,33 () -> new TestableTestRuleAdapter(new SimpleRuleAnnotatedMember(new TemporaryFolder()), Verifier.class));34 assertEquals(exception.getMessage(),35 "class org.junit.rules.Verifier is not assignable from class org.junit.rules.TemporaryFolder");36 }37 @Test38 void exceptionsDuringMethodLookupAreWrappedAndThrown() {39 AbstractTestRuleAdapter adapter = new AbstractTestRuleAdapter(40 new SimpleRuleAnnotatedMember(new ErrorCollector()), Verifier.class) {41 @Override42 public void before() {43 super.executeMethod("foo");44 }45 };46 JUnitException exception = assertThrows(JUnitException.class, adapter::before);47 assertEquals(exception.getMessage(), "Failed to find method foo() in class org.junit.rules.ErrorCollector");48 }49 private static class TestableTestRuleAdapter extends AbstractTestRuleAdapter {50 TestableTestRuleAdapter(TestRuleAnnotatedMember annotatedMember, Class<? extends TestRule> adapteeClass) {51 super(annotatedMember, adapteeClass);52 }53 }54 private static class SimpleRuleAnnotatedMember implements TestRuleAnnotatedMember {...