@Test public void When_Call_Illegal_Then_Get_Null() throws NoSuchMethodException { Method method = Providers.class.getDeclaredMethod("DTO"); DTO annotation = method.getAnnotation(DTO.class); Type type = method.getGenericReturnType(); Metadata<DTO> metadata = new Metadata<>(Providers.class, method, null, annotation, type); Object illegal = dtoMockery.illegal(metadata); assertNull(illegal); }