aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/junitparams/EnumsAsParamsTest.java
blob: 621cfede91cc6b715d45be1fc7456b58afec2b8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package junitparams;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.*;
import org.junit.runner.*;

import junitparams.usage.person_example.*;

@RunWith(JUnitParamsRunner.class)
public class EnumsAsParamsTest {

    @Test
    @Parameters({"SOME_VALUE", "OTHER_VALUE"})
    public void passEnumAsString(PersonType person) {
        assertThat(person).isIn(PersonType.SOME_VALUE, PersonType.OTHER_VALUE);
    }

    @Test
    @Parameters
    public void passEnumFromMethod(PersonType person) {
        assertThat(person).isIn(parametersForPassEnumFromMethod());
    }

    private PersonType[] parametersForPassEnumFromMethod() {
        return new PersonType[] {PersonType.SOME_VALUE, PersonType.OTHER_VALUE};
    }
}