Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
bclozel committed Dec 2, 2019
1 parent decbb9c commit 2105378
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -336,6 +337,18 @@ public void cloneDefaultCodecs() {
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);
Expand Down

0 comments on commit 2105378

Please sign in to comment.