@Test public void When_Call_Legal_Or_Illegal_With_Primitive_Type_Then_Matches_Expected_Type()
throws NoSuchMethodException {
Method method = Providers.class.getDeclaredMethod("checkPrimitives",
int.class, long.class, double.class, float.class);
Optional annotation = (Optional) method.getParameterAnnotations()[0][0];
Type type = method.getGenericParameterTypes()[0];
Metadata<Optional> metadata = new Metadata<>(Providers.class,
method, null, annotation, type);
assertThat((int) optionalMockery.illegal(metadata), is(0));
assertThat((int) optionalMockery.legal(metadata), is(0));
annotation = (Optional) method.getParameterAnnotations()[1][0];
type = method.getGenericParameterTypes()[1];
metadata = new Metadata<>(Providers.class,
method, null, annotation, type);
assertThat((long) optionalMockery.illegal(metadata), is(0l));
assertThat((long) optionalMockery.legal(metadata), is(0l));
annotation = (Optional) method.getParameterAnnotations()[2][0];
type = method.getGenericParameterTypes()[2];
metadata = new Metadata<>(Providers.class,
method, null, annotation, type);
assertThat((double) optionalMockery.illegal(metadata), is(0d));
assertThat((double) optionalMockery.legal(metadata), is(0d));
annotation = (Optional) method.getParameterAnnotations()[3][0];
type = method.getGenericParameterTypes()[3];
metadata = new Metadata<>(Providers.class,
method, null, annotation, type);
assertThat((float) optionalMockery.illegal(metadata), is(0f));
assertThat((float) optionalMockery.legal(metadata), is(0f));
}