Commit 4572ae54 authored by Andy Wilkinson's avatar Andy Wilkinson

Use reflection to extract Netty's default level

See gh-27046
parent f7140d04
......@@ -17,8 +17,11 @@
package org.springframework.boot.autoconfigure.netty;
import io.netty.util.ResourceLeakDetector;
import io.netty.util.ResourceLeakDetector.Level;
import org.junit.jupiter.api.Test;
import org.springframework.test.util.ReflectionTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
/**
......@@ -31,8 +34,9 @@ class NettyPropertiesTests {
@Test
void defaultValueShouldMatchNettys() {
NettyProperties properties = new NettyProperties();
assertThat(ResourceLeakDetector.Level.valueOf(properties.getLeakDetection().name()))
.isEqualTo(ResourceLeakDetector.getLevel());
ResourceLeakDetector.Level defaultLevel = (Level) ReflectionTestUtils.getField(ResourceLeakDetector.class,
"DEFAULT_LEVEL");
assertThat(ResourceLeakDetector.Level.valueOf(properties.getLeakDetection().name())).isEqualTo(defaultLevel);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment