@Test public void When_Empty_Array_Then_Throw_Exception()
throws NoSuchMethodException {
Method method = Providers.class
.getDeclaredMethod("emptyArray", String.class);
Enum annotation = (Enum) method.getParameterAnnotations()[0][0];
Type type = method.getGenericParameterTypes()[0];
Metadata<Enum> metadata = new Metadata<>(Providers.class,
method, null, annotation, type);
String errorMessage = Messages
.emptyEnumArray(Providers.class, method);
try {
enumMockery.legal(metadata);
fail();
} catch (RuntimeException e) {
assertThat(e.getMessage(), is(errorMessage));
}
try {
enumMockery.illegal(metadata);
fail();
} catch (RuntimeException e) {
assertThat(e.getMessage(), is(errorMessage));
}
try {
enumMockery.validate(metadata, "no matter");
fail();
} catch (RuntimeException e) {
assertThat(e.getMessage(), is(errorMessage));
}
}