Skip to content

Commit 99616e8

Browse files
committed
Remove shameless coverage code from SecurityNamespaceHandlerTests
Replace meaningless anonymous class instantiations with proper validation tests for BeanIds and Elements constants. Signed-off-by: seongm1n <[email protected]>
1 parent a5c38bd commit 99616e8

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

config/src/test/java/org/springframework/security/config/SecurityNamespaceHandlerTests.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
import org.mockito.Mock;
2424
import org.mockito.MockedStatic;
2525
import org.mockito.junit.jupiter.MockitoExtension;
26-
2726
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
2827
import org.springframework.security.config.util.InMemoryXmlApplicationContext;
2928
import org.springframework.security.config.util.SpringSecurityVersions;
3029
import org.springframework.test.util.ReflectionTestUtils;
3130
import org.springframework.util.ClassUtils;
3231

32+
import static org.assertj.core.api.Assertions.assertThat;
3333
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
3434
import static org.mockito.ArgumentMatchers.any;
3535
import static org.mockito.ArgumentMatchers.eq;
@@ -63,12 +63,19 @@ public class SecurityNamespaceHandlerTests {
6363

6464
@Test
6565
public void constructionSucceeds() {
66-
new SecurityNamespaceHandler();
67-
// Shameless class coverage stats boosting
68-
new BeanIds() {
69-
};
70-
new Elements() {
71-
};
66+
assertThat(new SecurityNamespaceHandler()).isNotNull();
67+
}
68+
69+
@Test
70+
public void beanIdsConstantsAreNotEmpty() {
71+
assertThat(BeanIds.AUTHENTICATION_MANAGER).isNotEmpty();
72+
assertThat(BeanIds.SPRING_SECURITY_FILTER_CHAIN).isNotEmpty();
73+
}
74+
75+
@Test
76+
public void elementsConstantsAreNotEmpty() {
77+
assertThat(Elements.HTTP).isNotEmpty();
78+
assertThat(Elements.AUTHENTICATION_MANAGER).isNotEmpty();
7279
}
7380

7481
@Test

0 commit comments

Comments
 (0)