Browse Source

Polish

pull/24135/head
Brian Clozel 5 years ago
parent
commit
21053780ef
  1. 13
      spring-web/src/test/java/org/springframework/http/codec/support/CodecConfigurerTests.java

13
spring-web/src/test/java/org/springframework/http/codec/support/CodecConfigurerTests.java

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
package org.springframework.http.codec.support;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@ -336,6 +337,18 @@ public class CodecConfigurerTests { @@ -336,6 +337,18 @@ public class CodecConfigurerTests {
assertThat(encoders).doesNotContain(jacksonEncoder, jaxb2Encoder, protoEncoder);
}
@Test
void withDefaultCodecConfig() {
AtomicBoolean callbackCalled = new AtomicBoolean(false);
this.configurer.defaultCodecs().enableLoggingRequestDetails(true);
this.configurer.customCodecs().withDefaultCodecConfig(config -> {
assertThat(config.isEnableLoggingRequestDetails()).isTrue();
callbackCalled.compareAndSet(false, true);
});
this.configurer.getReaders();
assertThat(callbackCalled).isTrue();
}
private Decoder<?> getNextDecoder(List<HttpMessageReader<?>> readers) {
HttpMessageReader<?> reader = readers.get(this.index.getAndIncrement());
assertThat(reader.getClass()).isEqualTo(DecoderHttpMessageReader.class);

Loading…
Cancel
Save