@Ignore @Test(expected = IllegalStateException.class) public void formatMethodResponseShouldWorkWhenNullJmapResponse() { String expectedMethod = "nwonMethod"; String expectedMethodCallId = "#1"; String expectedId = "myId"; Stream<InvocationResponse> response = testee.formatMethodResponse(Flux.just(JmapResponse .builder() .methodCallId(MethodCallId.of(expectedMethodCallId)) .response(null) .build())) .toStream(); List<InvocationResponse> responseList = response.collect(Collectors.toList()); assertThat(responseList).hasSize(1) .extracting(InvocationResponse::getResponseName, x -> x.getResults().get("id").asText(), InvocationResponse::getMethodCallId) .containsExactly(tuple(expectedMethod, expectedId, expectedMethodCallId)); }
@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; }