This is an automated email from the ASF dual-hosted git repository. smolnar82 pushed a commit to branch knox_idf in repository https://gitbox.apache.org/repos/asf/knox.git
commit a425278ddadaa3912f4afa64effc6ae5734fb135 Author: Sandor Molnar <[email protected]> AuthorDate: Fri Jul 24 20:31:32 2026 +0200 KNOX-3390: Corrected JUnit test coverage for max issuers (#1326) --- .../trustedoidcissuer/JdbcTrustedOidcIssuerServiceTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/services/knoxidf/trustedoidcissuer/JdbcTrustedOidcIssuerServiceTest.java b/gateway-server/src/test/java/org/apache/knox/gateway/services/knoxidf/trustedoidcissuer/JdbcTrustedOidcIssuerServiceTest.java index bccd9274a..e74e476cf 100644 --- a/gateway-server/src/test/java/org/apache/knox/gateway/services/knoxidf/trustedoidcissuer/JdbcTrustedOidcIssuerServiceTest.java +++ b/gateway-server/src/test/java/org/apache/knox/gateway/services/knoxidf/trustedoidcissuer/JdbcTrustedOidcIssuerServiceTest.java @@ -38,8 +38,8 @@ import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; public class JdbcTrustedOidcIssuerServiceTest { @@ -217,7 +217,7 @@ public class JdbcTrustedOidcIssuerServiceTest { assertTrue(service.list().isEmpty()); } - @Test(expected = IllegalStateException.class) + @Test public void testMaxTrustedIssuers() throws ServiceLifecycleException { final GatewayConfig limitedConfig = EasyMock.createNiceMock(GatewayConfig.class); EasyMock.expect(limitedConfig.getDatabaseType()).andReturn(DatabaseType.DERBY.type()).anyTimes(); @@ -235,9 +235,11 @@ public class JdbcTrustedOidcIssuerServiceTest { limitedService.register(issuer("https://b.example.com", false)); assertEquals("Second registration must succeed", 2, limitedService.list().size()); - // this one should fail (see expected error on the test annotation) - limitedService.register(issuer("https://c.example.com", false)); - fail("Expected IllegalStateException when exceeding max issuers limit"); + assertThrows(IllegalStateException.class, + () -> limitedService.register(issuer("https://c.example.com", false))); + + assertEquals("Prior registrations must be unaffected by the rejected call", + 2, limitedService.list().size()); } @Test
