### Question:
KMSACLs implements Runnable { public boolean hasAccess(Type type, String user) { UserGroupInformation ugi = UserGroupInformation.createRemoteUser(user); AccessControlList acl = null; lock.readLock().lock(); try { acl = acls.get(type); } finally { lock.readLock().unlock(); } return acl.isUserAllowed(ugi); } KMSACLs(Configuration conf);  KMSACLs(); @Override void run(); synchronized void startReloader(); synchronized void stopReloader(); boolean hasAccess(Type type, String user); static final String ACL_DEFAULT; static final int RELOADER_SLEEP_MILLIS; }### Answer:
@Test public void testDefaults() { KMSACLs acls = new KMSACLs(new Configuration(false)); for (KMSACLs.Type type : KMSACLs.Type.values()) { Assert.assertTrue(acls.hasAccess(type, "foo")); } }
@Test public void testCustom() { Configuration conf = new Configuration(false); for (KMSACLs.Type type : KMSACLs.Type.values()) { conf.set(type.getConfigKey(), type.toString() + " "); } KMSACLs acls = new KMSACLs(conf); for (KMSACLs.Type type : KMSACLs.Type.values()) { Assert.assertTrue(acls.hasAccess(type, type.toString())); Assert.assertFalse(acls.hasAccess(type, "foo")); } }