Skip to content

Commit

Permalink
Increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rrva committed Nov 1, 2022
1 parent b3e1eae commit da4d961
Showing 1 changed file with 13 additions and 0 deletions.
Expand Up @@ -23,6 +23,19 @@ public void test_prohibits_sun_misc_package_access() {
thrown.getMessage());
}

@Test
public void test_prohibits_sun_misc_access_runtime_permission() {
SunMiscProhibitedSecurityManager sm = new SunMiscProhibitedSecurityManager();
AccessControlException thrown =
Assertions.assertThrows(
AccessControlException.class,
() -> sm.checkPermission(new RuntimePermission("accessClassInPackage.sun.misc")));

Assertions.assertEquals(
"access denied (\"java.lang.RuntimePermission\" \"accessClassInPackage.sun.misc\")",
thrown.getMessage());
}

@Test
public void test_allows_other_package_access() {
SunMiscProhibitedSecurityManager sm = new SunMiscProhibitedSecurityManager();
Expand Down

0 comments on commit da4d961

Please sign in to comment.