@@ -0,0 +1,1930 @@
+/*%0A * #%25L%0A * wcm.io%0A * %25%25%0A * Copyright (C) 2014 wcm.io%0A * %25%25%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 implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A * #L%25%0A */%0Apackage io.wcm.testing.junit.rules.parameterized;%0A%0A/*%0A * (C) 2012 Jens Schauder http://blog.schauderhaft.de/%0A * Code initially published here https://github.com/schauder/parameterizedTestsWithRules%0A * Slightly simplified for wcm.io.%0A */%0Aimport static org.junit.Assert.assertTrue;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.times;%0Aimport static org.mockito.Mockito.verify;%0A%0Aimport java.util.Arrays;%0A%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0A//CHECKSTYLE:OFF%0A@SuppressWarnings(%22javadoc%22)%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class ListRuleWithCallbacksTest %7B%0A%0A  @SuppressWarnings(%22unchecked%22)%0A  private final Callback%3CInteger%3E setUpCallback = mock(Callback.class);%0A%0A  @SuppressWarnings(%22unchecked%22)%0A  private final Callback%3CInteger%3E tearDownCallback = mock(Callback.class);%0A%0A  @Rule%0A  public Generator%3CInteger%3E generator = new ListGenerator%3CInteger%3E(Arrays.asList(new Integer%5B%5D %7B%0A      23, 42, 5%0A  %7D), this.setUpCallback, this.tearDownCallback);%0A%0A  @Test%0A  public void allGivenNumbersAreX() %7B%0A    Integer currentValue = this.generator.value();%0A    assertTrue(Arrays.asList(5, 42, 23).contains(currentValue));%0A    verify(this.setUpCallback, times(1)).execute(currentValue);%0A  %7D%0A%0A%7D%0A

test with callbacks