### Question:
CarbonSecurityManager extends SecurityManager { public void checkAccess(ThreadGroup g) { if (g == null) { throw new NullPointerException("thread group can't be null"); } checkPermission(SecurityConstants.MODIFY_THREADGROUP_PERMISSION); } CarbonSecurityManager(); @Override void checkPropertyAccess(String key); void checkAccess(ThreadGroup g); void checkAccess(Thread t);  }### Answer:
@Test(expectedExceptions = NullPointerException.class) public void testCheckAccessNullThread() { System.setProperty("denied.system.properties", "mockDeniedProperty"); carbonSecurityManager = new CarbonSecurityManager(); Thread thread = null; assertNull(thread); carbonSecurityManager.checkAccess(thread); }
@Test(expectedExceptions = NullPointerException.class) public void testCheckAccessNullThreadGroup() { System.setProperty("denied.system.properties", "mockDeniedProperty"); carbonSecurityManager = new CarbonSecurityManager(); ThreadGroup threadGroup = null; assertNull(threadGroup); carbonSecurityManager.checkAccess(threadGroup); }
@Test(expectedExceptions = AccessControlException.class) public void testCheckAccessThread() { System.setProperty("denied.system.properties", "mockDeniedProperty"); carbonSecurityManager = new CarbonSecurityManager(); Thread thread = mock(Thread.class); carbonSecurityManager.checkAccess(thread); }
@Test(expectedExceptions = AccessControlException.class) public void testCheckAccessThreadGroup() { System.setProperty("denied.system.properties", "mockDeniedProperty"); carbonSecurityManager = new CarbonSecurityManager(); ThreadGroup threadGroup = mock(ThreadGroup.class); carbonSecurityManager.checkAccess(threadGroup); }