Search in sources :

Example 1 with EnumListConverter

use of org.jbehave.core.steps.ParameterConverters.EnumListConverter in project jbehave-core by jbehave.

the class ParameterConvertersBehaviour method shouldConvertEnumList.

@Test
public void shouldConvertEnumList() {
    ParameterConverter converter = new EnumListConverter();
    Type type = new TypeLiteral<List<SomeEnum>>() {
    }.getType();
    assertThat(converter.accept(type), is(true));
    List<Enum> list = (List<Enum>) converter.convertValue("ONE,TWO,THREE", type);
    assertThatCollectionIs(list, SomeEnum.ONE, SomeEnum.TWO, SomeEnum.THREE);
}
Also used : Type(java.lang.reflect.Type) AbstractParameterConverter(org.jbehave.core.steps.ParameterConverters.AbstractParameterConverter) ParameterConverter(org.jbehave.core.steps.ParameterConverters.ParameterConverter) Arrays.asList(java.util.Arrays.asList) EnumListConverter(org.jbehave.core.steps.ParameterConverters.EnumListConverter) Test(org.junit.Test)

Aggregations

Type (java.lang.reflect.Type)1 Arrays.asList (java.util.Arrays.asList)1 AbstractParameterConverter (org.jbehave.core.steps.ParameterConverters.AbstractParameterConverter)1 EnumListConverter (org.jbehave.core.steps.ParameterConverters.EnumListConverter)1 ParameterConverter (org.jbehave.core.steps.ParameterConverters.ParameterConverter)1 Test (org.junit.Test)1