TemplateValues { public static <T> TemplateValue enumeration(final T... options) { return new EnumeratingTemplateValue<T>(Lists.newArrayList(options)); } private  TemplateValues(); static TemplateValue base64(); static TemplateValue character(); static TemplateValue date(); static TemplateValue modulo(final long modulus); static TemplateValue string(final String template); static TemplateValue timestamp(); static TemplateValue time(); static TemplateValue enumeration(final T... options); static final Base64TemplateValue BASE_64_TEMPLATE_VALUE; static final CharTemplateValue CHAR_TEMPLATE_VALUE; static final DateTemplateValue DATE_TEMPLATE_VALUE; static final TimestampTemplateValue TIMESTAMP_TEMPLATE_VALUE; static final TimeTemplateValue TIME_TEMPLATE_VALUE; }
@Test public void enumeratingTemplateValue_should_returnCorrectInstance() { assertThat(TemplateValues.enumeration("1", "2"), instanceOf(EnumeratingTemplateValue.class)); }
@Test public void enumeratingOnEnums_should_bePossible() { final TemplateValue templateValue = TemplateValues.enumeration(MyEnum.values()); assertThat((MyEnum) templateValue.transform(0), is(MyEnum.A)); assertThat((MyEnum) templateValue.transform(1), is(MyEnum.B)); assertThat((MyEnum) templateValue.transform(2), is(MyEnum.C)); assertThat((MyEnum) templateValue.transform(3), is(MyEnum.A)); }