1 package junitparams; 2 3 import static org.assertj.core.api.Assertions.*; 4 5 import java.util.HashSet; 6 import java.util.Set; 7 8 import org.junit.AfterClass; 9 import org.junit.Test; 10 import org.junit.runner.RunWith; 11 12 @RunWith(JUnitParamsRunner.class) 13 public class ParametersForEnumTest { 14 15 private static Set<Fruit> testedFruits = new HashSet<Fruit>(); 16 17 @AfterClass checkAllFruitsTested()18 public static void checkAllFruitsTested() { 19 assertThat(testedFruits).contains(Fruit.class.getEnumConstants()); 20 } 21 22 @Test 23 @Parameters(source = Fruit.class) testAFruit(Fruit fruit)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