"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spring-web/src/test/java/org/springframework/http/codec/support/ClientCodecConfigurerTests.java" between
spring-framework-5.3.7.tar.gz and spring-framework-5.3.8.tar.gz

About: Spring Framework is an application framework for the Java platform and .NET Framework. Community edition.

ClientCodecConfigurerTests.java  (spring-framework-5.3.7):ClientCodecConfigurerTests.java  (spring-framework-5.3.8)
skipping to change at line 125 skipping to change at line 125
assertThat(writers.get(index.getAndIncrement()).getClass()).isEqu alTo(ProtobufHttpMessageWriter.class); assertThat(writers.get(index.getAndIncrement()).getClass()).isEqu alTo(ProtobufHttpMessageWriter.class);
assertThat(writers.get(this.index.getAndIncrement()).getClass()). isEqualTo(MultipartHttpMessageWriter.class); assertThat(writers.get(this.index.getAndIncrement()).getClass()). isEqualTo(MultipartHttpMessageWriter.class);
assertThat(getNextEncoder(writers).getClass()).isEqualTo(KotlinSe rializationJsonEncoder.class); assertThat(getNextEncoder(writers).getClass()).isEqualTo(KotlinSe rializationJsonEncoder.class);
assertThat(getNextEncoder(writers).getClass()).isEqualTo(Jackson2 JsonEncoder.class); assertThat(getNextEncoder(writers).getClass()).isEqualTo(Jackson2 JsonEncoder.class);
assertThat(getNextEncoder(writers).getClass()).isEqualTo(Jackson2 SmileEncoder.class); assertThat(getNextEncoder(writers).getClass()).isEqualTo(Jackson2 SmileEncoder.class);
assertThat(getNextEncoder(writers).getClass()).isEqualTo(Jaxb2Xml Encoder.class); assertThat(getNextEncoder(writers).getClass()).isEqualTo(Jaxb2Xml Encoder.class);
assertStringEncoder(getNextEncoder(writers), false); assertStringEncoder(getNextEncoder(writers), false);
} }
@Test @Test
public void jackson2CodecCustomizations() { public void jackson2CodecCustomization() {
Jackson2JsonDecoder decoder = new Jackson2JsonDecoder(); Jackson2JsonDecoder decoder = new Jackson2JsonDecoder();
Jackson2JsonEncoder encoder = new Jackson2JsonEncoder(); Jackson2JsonEncoder encoder = new Jackson2JsonEncoder();
this.configurer.defaultCodecs().jackson2JsonDecoder(decoder); this.configurer.defaultCodecs().jackson2JsonDecoder(decoder);
this.configurer.defaultCodecs().jackson2JsonEncoder(encoder); this.configurer.defaultCodecs().jackson2JsonEncoder(encoder);
List<HttpMessageReader<?>> readers = this.configurer.getReaders()
;
Jackson2JsonDecoder actualDecoder = findCodec(readers, Jackson2Js
onDecoder.class);
assertThat(actualDecoder).isSameAs(decoder);
assertThat(findCodec(readers, ServerSentEventHttpMessageReader.cl
ass).getDecoder()).isSameAs(decoder);
List<HttpMessageWriter<?>> writers = this.configurer.getWriters()
;
Jackson2JsonEncoder actualEncoder = findCodec(writers, Jackson2Js
onEncoder.class);
assertThat(actualEncoder).isSameAs(encoder);
MultipartHttpMessageWriter multipartWriter = findCodec(writers, M
ultipartHttpMessageWriter.class);
actualEncoder = findCodec(multipartWriter.getPartWriters(), Jacks
on2JsonEncoder.class);
assertThat(actualEncoder).isSameAs(encoder);
}
@Test
public void objectMapperCustomization() {
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
this.configurer.defaultCodecs().configureDefaultCodec(codec -> { this.configurer.defaultCodecs().configureDefaultCodec(codec -> {
if (codec instanceof Jackson2CodecSupport) { if (codec instanceof Jackson2CodecSupport) {
((Jackson2CodecSupport) codec).setObjectMapper(ob jectMapper); ((Jackson2CodecSupport) codec).setObjectMapper(ob jectMapper);
} }
}); });
List<HttpMessageReader<?>> readers = this.configurer.getReaders() ; List<HttpMessageReader<?>> readers = this.configurer.getReaders() ;
Jackson2JsonDecoder actualDecoder = findCodec(readers, Jackson2Js onDecoder.class); Jackson2JsonDecoder actualDecoder = findCodec(readers, Jackson2Js onDecoder.class);
assertThat(actualDecoder).isSameAs(decoder);
assertThat(actualDecoder.getObjectMapper()).isSameAs(objectMapper ); assertThat(actualDecoder.getObjectMapper()).isSameAs(objectMapper );
assertThat(findCodec(readers, ServerSentEventHttpMessageReader.cl ass).getDecoder()).isSameAs(decoder);
List<HttpMessageWriter<?>> writers = this.configurer.getWriters() ; List<HttpMessageWriter<?>> writers = this.configurer.getWriters() ;
Jackson2JsonEncoder actualEncoder = findCodec(writers, Jackson2Js onEncoder.class); Jackson2JsonEncoder actualEncoder = findCodec(writers, Jackson2Js onEncoder.class);
assertThat(actualEncoder).isSameAs(encoder); assertThat(actualEncoder.getObjectMapper()).isSameAs(objectMapper
);
MultipartHttpMessageWriter multipartWriter = findCodec(writers, M
ultipartHttpMessageWriter.class);
actualEncoder = findCodec(multipartWriter.getPartWriters(), Jacks
on2JsonEncoder.class);
assertThat(actualEncoder.getObjectMapper()).isSameAs(objectMapper ); assertThat(actualEncoder.getObjectMapper()).isSameAs(objectMapper );
} }
@Test @Test
public void maxInMemorySize() { public void maxInMemorySize() {
int size = 99; int size = 99;
this.configurer.defaultCodecs().maxInMemorySize(size); this.configurer.defaultCodecs().maxInMemorySize(size);
List<HttpMessageReader<?>> readers = this.configurer.getReaders() ; List<HttpMessageReader<?>> readers = this.configurer.getReaders() ;
assertThat(readers.size()).isEqualTo(14); assertThat(readers.size()).isEqualTo(14);
assertThat(((ByteArrayDecoder) getNextDecoder(readers)).getMaxInM emorySize()).isEqualTo(size); assertThat(((ByteArrayDecoder) getNextDecoder(readers)).getMaxInM emorySize()).isEqualTo(size);
 End of changes. 5 change blocks. 
4 lines changed or deleted 31 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)