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 e445ca53cbd2920a99855b1a94cc8fdf9deca285 Author: Sandor Molnar <[email protected]> AuthorDate: Thu Aug 13 19:34:42 2026 +0200 KNOX-3414: satisfy PMD JUnitUseExpected in client-secret resolution test Convert testEmptyResolvedSecretFailsClosed to @Test(expected=...) since its catch block makes no assertions on the exception. The sibling test that inspects the exception message keeps the try/fail/catch form. Co-Authored-By: Claude Opus 4.8 <[email protected]> --- .../knoxidf/AuthorizeResourceClientSecretResolutionTest.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/gateway-service-knoxidf/src/test/java/org/apache/knox/gateway/service/knoxidf/AuthorizeResourceClientSecretResolutionTest.java b/gateway-service-knoxidf/src/test/java/org/apache/knox/gateway/service/knoxidf/AuthorizeResourceClientSecretResolutionTest.java index f67937c61..3915d7dd7 100644 --- a/gateway-service-knoxidf/src/test/java/org/apache/knox/gateway/service/knoxidf/AuthorizeResourceClientSecretResolutionTest.java +++ b/gateway-service-knoxidf/src/test/java/org/apache/knox/gateway/service/knoxidf/AuthorizeResourceClientSecretResolutionTest.java @@ -47,13 +47,8 @@ public class AuthorizeResourceClientSecretResolutionTest { } } - @Test + @Test(expected = ClientSecretResolutionException.class) public void testEmptyResolvedSecretFailsClosed() { - try { - AuthorizeResource.requireResolvedAliasSecret("op.secret.alias", new char[0]); - fail("An alias resolving to an empty secret must fail closed."); - } catch (ClientSecretResolutionException e) { - // expected - } + AuthorizeResource.requireResolvedAliasSecret("op.secret.alias", new char[0]); } }
