/** * Serialize the DTO illegal object deferred from its mockery as the content of a {@code RequestBody}. * @see DTO.Behaviour */ @Override public Object illegal(Metadata<RequestBodyDTO> metadata) { Object illegal = dtoJsonMockery.illegal(DTOJsonMetadata(metadata)); RequestBody requestBodyIllegal = RequestBody .create(MediaType.parse("text/plain"), illegal.toString()); return requestBodyIllegal; }
@Test public void When_Call_Illegal_Then_Then_Get_Empty_String() throws NoSuchMethodException { Method method = ProvidersJsonConverter.class.getDeclaredMethod("mock", String.class); DTOJson annotation = (DTOJson) method.getParameterAnnotations()[0][0]; Type type = method.getGenericParameterTypes()[0]; Metadata<DTOJson> metadata = new Metadata<>(ProvidersJsonConverter.class, method, null, annotation, type); String illegal = (String) dtoJsonMockery.illegal(metadata); assertTrue(illegal.isEmpty()); }