use of org.springframework.http.codec.json.JacksonViewBean.MyJacksonView1 in project spring-framework by spring-projects.
the class Jackson2JsonDecoderTests method fieldLevelJsonView.
@Test
public void fieldLevelJsonView() {
Flux<DataBuffer> input = Flux.from(stringBuffer("{\"withView1\" : \"with\", \"withView2\" : \"with\", \"withoutView\" : \"without\"}"));
ResolvableType elementType = ResolvableType.forClass(JacksonViewBean.class);
Map<String, Object> hints = Collections.singletonMap(JSON_VIEW_HINT, MyJacksonView1.class);
testDecode(input, elementType, step -> step.consumeNextWith(value -> {
JacksonViewBean bean = (JacksonViewBean) value;
assertThat(bean.getWithView1()).isEqualTo("with");
assertThat(bean.getWithView2()).isNull();
assertThat(bean.getWithoutView()).isNull();
}), null, hints);
}
Aggregations