use of org.apache.tapestry5.SelectModel in project tapestry-5 by apache.
the class EnumSelectModelTest method error_on_invalid_class.
@Test
public // TAP5-2495
void error_on_invalid_class() {
Messages messages = mockMessages();
replay();
Class c = String.class;
try {
SelectModel model = new EnumSelectModel(c, messages);
fail("should have thrown an exception");
} catch (IllegalArgumentException e) {
assertMessageContains(e, "not an enum class");
}
verify();
}
use of org.apache.tapestry5.SelectModel in project tapestry-5 by apache.
the class EnumSelectModelTest method unprefixed_name_in_message_catalog.
@Test
public void unprefixed_name_in_message_catalog() {
Messages messages = mockMessages();
stub_contains(messages, false);
train_contains(messages, "MOE", true);
train_get(messages, "MOE", "Sir Moe Howard");
replay();
SelectModel model = new EnumSelectModel(Stooge.class, messages);
List<OptionModel> options = model.getOptions();
assertEquals(options.size(), 3);
checkOption(options, 0, "Sir Moe Howard", Stooge.MOE);
checkOption(options, 1, "Larry", Stooge.LARRY);
checkOption(options, 2, "Curly Joe", Stooge.CURLY_JOE);
verify();
}
Aggregations