@@ -0,0 +1,1644 @@
+/*%0A * Copyright 2014 Paul Merlin.%0A *%0A * Licensed  under the  Apache License,  Version 2.0  (the %22License%22);%0A * you may not use  this file  except in  compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *   http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed  under the  License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or%0A * implied.%0A *%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.qi4j.test.util;%0A%0Aimport org.junit.rules.TestRule;%0Aimport org.junit.runner.Description;%0Aimport org.junit.runners.model.Statement;%0A%0A/**%0A * JUnit Rule to run tests repeatedly.%0A *%0A * %3Cp%3ETo repeat a complete test class:%3C/p%3E%0A * %3Cpre%3E@ClassRule public static final RepeatRule REPEAT = new RepeatRule( 10 );%3C/pre%3E%0A *%0A * %3Cp%3ETo repeat each test on the same test class instance:%3C/p%3E%0A * %3Cpre%3E@Rule public final RepeatRule repeat = new RepeatRule( 10 );%3C/pre%3E%0A */%0Apublic class RepeatRule%0A    implements TestRule%0A%7B%0A    private final int count;%0A%0A    public RepeatRule( int count )%0A    %7B%0A        this.count = count;%0A    %7D%0A%0A    @Override%0A    public Statement apply( final Statement base, Description description )%0A    %7B%0A        return new Statement()%0A        %7B%0A            @Override%0A            public void evaluate()%0A                throws Throwable%0A            %7B%0A                for( int repeat = 0; repeat %3C count; repeat++ )%0A                %7B%0A                    base.evaluate();%0A                %7D%0A            %7D%0A        %7D;%0A    %7D%0A%0A%7D%0A

Test Support: introduce RepeatRule