Skip to content

Commit 4572ae5

Browse files
committed
Use reflection to extract Netty's default level
See gh-27046
1 parent f7140d0 commit 4572ae5

File tree

1 file changed

+6
-2
lines changed
  • spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/netty

1 file changed

+6
-2
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/netty/NettyPropertiesTests.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
package org.springframework.boot.autoconfigure.netty;
1818

1919
import io.netty.util.ResourceLeakDetector;
20+
import io.netty.util.ResourceLeakDetector.Level;
2021
import org.junit.jupiter.api.Test;
2122

23+
import org.springframework.test.util.ReflectionTestUtils;
24+
2225
import static org.assertj.core.api.Assertions.assertThat;
2326

2427
/**
@@ -31,8 +34,9 @@ class NettyPropertiesTests {
3134
@Test
3235
void defaultValueShouldMatchNettys() {
3336
NettyProperties properties = new NettyProperties();
34-
assertThat(ResourceLeakDetector.Level.valueOf(properties.getLeakDetection().name()))
35-
.isEqualTo(ResourceLeakDetector.getLevel());
37+
ResourceLeakDetector.Level defaultLevel = (Level) ReflectionTestUtils.getField(ResourceLeakDetector.class,
38+
"DEFAULT_LEVEL");
39+
assertThat(ResourceLeakDetector.Level.valueOf(properties.getLeakDetection().name())).isEqualTo(defaultLevel);
3640
}
3741

3842
}

0 commit comments

Comments
 (0)