@Test public void formatMethodResponseShouldNotFilterFieldsWhenSecondCallWithoutProperties() { ObjectResponseClass responseClass = new ObjectResponseClass(); responseClass.list = ImmutableList.of(new ObjectResponseClass.Foo("id", "name")); Property property = () -> "id"; @SuppressWarnings("unused") Stream<InvocationResponse> ignoredResponse = testee.formatMethodResponse( Flux.just(JmapResponse .builder() .responseName(Method.Response.name("unknownMethod")) .methodCallId(MethodCallId.of("#1")) .properties(ImmutableSet.of(property)) .response(responseClass) .build())) .toStream(); List<InvocationResponse> response = testee.formatMethodResponse( Flux.just(JmapResponse .builder() .responseName(Method.Response.name("unknownMethod")) .methodCallId(MethodCallId.of("#1")) .response(responseClass) .build())) .collect(Collectors.toList()) .block(); assertThat(response).hasSize(1); JsonNode firstObject = Iterables.getOnlyElement(response).getResults().get("list").elements().next(); assertThat(firstObject.get("id").asText()).isEqualTo("id"); assertThat(firstObject.get("name").asText()).isEqualTo("name"); }
@Override public Flux<InvocationResponse> formatMethodResponse(Flux<JmapResponse> jmapResponses) { return jmapResponses.map(jmapResponse -> { ObjectMapper objectMapper = newConfiguredObjectMapper(jmapResponse); return new InvocationResponse( jmapResponse.getResponseName(), objectMapper.valueToTree(jmapResponse.getResponse()), jmapResponse.getMethodCallId()); }); }
JmapResponseWriterImpl implements JmapResponseWriter { @Override public Flux<InvocationResponse> formatMethodResponse(Flux<JmapResponse> jmapResponses) { return jmapResponses.map(jmapResponse -> { ObjectMapper objectMapper = newConfiguredObjectMapper(jmapResponse); return new InvocationResponse( jmapResponse.getResponseName(), objectMapper.valueToTree(jmapResponse.getResponse()), jmapResponse.getMethodCallId()); }); } }
JmapResponseWriterImpl implements JmapResponseWriter { @Override public Flux<InvocationResponse> formatMethodResponse(Flux<JmapResponse> jmapResponses) { return jmapResponses.map(jmapResponse -> { ObjectMapper objectMapper = newConfiguredObjectMapper(jmapResponse); return new InvocationResponse( jmapResponse.getResponseName(), objectMapper.valueToTree(jmapResponse.getResponse()), jmapResponse.getMethodCallId()); }); } @Inject  JmapResponseWriterImpl(ObjectMapperFactory objectMapperFactory); }
JmapResponseWriterImpl implements JmapResponseWriter { @Override public Flux<InvocationResponse> formatMethodResponse(Flux<JmapResponse> jmapResponses) { return jmapResponses.map(jmapResponse -> { ObjectMapper objectMapper = newConfiguredObjectMapper(jmapResponse); return new InvocationResponse( jmapResponse.getResponseName(), objectMapper.valueToTree(jmapResponse.getResponse()), jmapResponse.getMethodCallId()); }); } @Inject  JmapResponseWriterImpl(ObjectMapperFactory objectMapperFactory); @Override Flux<InvocationResponse> formatMethodResponse(Flux<JmapResponse> jmapResponses); }
JmapResponseWriterImpl implements JmapResponseWriter { @Override public Flux<InvocationResponse> formatMethodResponse(Flux<JmapResponse> jmapResponses) { return jmapResponses.map(jmapResponse -> { ObjectMapper objectMapper = newConfiguredObjectMapper(jmapResponse); return new InvocationResponse( jmapResponse.getResponseName(), objectMapper.valueToTree(jmapResponse.getResponse()), jmapResponse.getMethodCallId()); }); } @Inject  JmapResponseWriterImpl(ObjectMapperFactory objectMapperFactory); @Override Flux<InvocationResponse> formatMethodResponse(Flux<JmapResponse> jmapResponses); static final String PROPERTIES_FILTER; }