1 package junitparams; 2 3 import static org.assertj.core.api.Assertions.assertThat; 4 5 import org.junit.*; 6 import org.junit.runner.*; 7 8 import junitparams.usage.person_example.*; 9 10 @RunWith(JUnitParamsRunner.class) 11 public class EnumsAsParamsTest { 12 13 @Test 14 @Parameters({"SOME_VALUE", "OTHER_VALUE"}) passEnumAsString(PersonType person)15 public void passEnumAsString(PersonType person) { 16 assertThat(person).isIn(PersonType.SOME_VALUE, PersonType.OTHER_VALUE); 17 } 18 19 @Test 20 @Parameters passEnumFromMethod(PersonType person)21 public void passEnumFromMethod(PersonType person) { 22 assertThat(person).isIn(parametersForPassEnumFromMethod()); 23 } 24 parametersForPassEnumFromMethod()25 private PersonType[] parametersForPassEnumFromMethod() { 26 return new PersonType[] {PersonType.SOME_VALUE, PersonType.OTHER_VALUE}; 27 } 28 } 29