package junitparams;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.*;
import org.junit.rules.*;
import org.junit.runner.*;

@RunWith(JUnitParamsRunner.class)
public class RulesTest {
    @Rule
    public TemporaryFolder folder = new TemporaryFolder();
    @Rule
    public ExpectedException exception = ExpectedException.none();
    @Rule
    public ErrorCollector errors = new ErrorCollector();
    @Rule
    public TestName testName = new TestName();
    @Rule
    public TestWatcher testWatcher = new TestWatcher() {
    };
    @Rule
    public Timeout timeout = new Timeout(0);


    @Test
    @Parameters("")
    public void shouldHandleRulesProperly(String n) {
        assertThat(testName.getMethodName()).isEqualTo("shouldHandleRulesProperly");
    }

    @Test
    public void shouldProvideHelpfulExceptionMessageWhenRuleIsUsedImproperly() {
        Result result = JUnitCore.runClasses(ProtectedRuleTest.class);
        assertThat(result.getFailureCount()).isEqualTo(1);

        String exceptionMessage = result.getFailures().get(0).getException().getMessage();
        assertThat(exceptionMessage).isEqualTo("The @Rule 'testRule' must be public.");
    }

    public class ProtectedRuleTest {
        @Rule
        TestRule testRule;

        @Test
        public void test() {

        }
    }

}

@@ -26,59 +26,301 @@
 ort 
-static org.assertj.core.api.Assertions.assertThat;%0A
+org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.ErrorCollector;%0Aimport org.junit.rules.ExpectedException;%0Aimport org.junit.rules.TemporaryFolder;%0Aimport org.junit.rules.TestName;%0Aimport org.junit.rules.TestRule;%0Aimport org.junit.rules.TestWatcher;%0Aimport org.junit.rules.Timeout;
 %0Aimp
@@ -333,17 +333,32 @@
 g.junit.
-*
+runner.JUnitCore
 ;%0Aimport
@@ -374,13 +374,19 @@
 t.ru
-les.*
+nner.Result
 ;%0Aim
@@ -407,16 +407,72 @@
 .runner.
+RunWith;%0A%0Aimport static org.assertj.core.api.Assertions.
 *;%0A%0A@Run
@@ -1265,16 +1265,17 @@
 class);%0A
+%0A
         
@@ -1325,25 +1325,24 @@
 lTo(1);%0A
-%0A
         
 String e
@@ -1337,34 +1337,19 @@
     
-String exceptionMessage = 
+assertThat(
 resu
@@ -1390,69 +1390,37 @@
 on()
-.getMessage();%0A        assertThat(exceptionMessage).isEqualTo
+)%0A                .hasMessage
 (%22Th

shorter assertion