1package junitparams; 2 3import static org.assertj.core.api.Assertions.*; 4 5import java.util.HashSet; 6import java.util.Set; 7 8import org.junit.AfterClass; 9import org.junit.Test; 10import org.junit.runner.RunWith; 11 12@RunWith(JUnitParamsRunner.class) 13public class ParametersForEnumTest { 14 15 private static Set<Fruit> testedFruits = new HashSet<Fruit>(); 16 17 @AfterClass 18 public static void checkAllFruitsTested() { 19 assertThat(testedFruits).contains(Fruit.class.getEnumConstants()); 20 } 21 22 @Test 23 @Parameters(source = Fruit.class) 24 public void testAFruit(Fruit fruit) throws Exception { 25 testedFruits.add(fruit); 26 } 27 28 public enum Fruit { 29 APPLE, 30 BANANA, 31 PEAR, 32 PLUM 33 } 34 35} 36