### Question:
DatawaveRoleManager implements RoleManager { @Override public boolean canRunQuery(QueryLogic<?> queryLogic, Principal principal) { if (principal instanceof DatawavePrincipal == false) return false; DatawavePrincipal datawavePrincipal = (DatawavePrincipal) principal; if (requiredRoles != null && !requiredRoles.isEmpty()) { Set<String> usersRoles = new HashSet<>(datawavePrincipal.getPrimaryUser().getRoles()); return usersRoles.containsAll(requiredRoles); } return true; } DatawaveRoleManager();  DatawaveRoleManager(Collection<String> requiredRoles); @Override boolean canRunQuery(QueryLogic<?> queryLogic, Principal principal); Set<String> getRequiredRoles(); void setRequiredRoles(Set<String> requiredRoles);  }### Answer:
@Test public void testCanRunQuery() { drm = new DatawaveRoleManager(getFirstRole()); boolean canRun = drm.canRunQuery(null, null); Assert.assertFalse(canRun); p = datawavePrincipal; Assert.assertNotEquals(null, p); drm.setRequiredRoles(null); canRun = drm.canRunQuery(null, p); Assert.assertTrue(canRun); drm.setRequiredRoles(getFirstRole()); canRun = drm.canRunQuery(null, p); Assert.assertTrue(canRun); drm.setRequiredRoles(getAllRoles()); canRun = drm.canRunQuery(null, p); Assert.assertFalse(canRun); createAndSetWithTwoRoles(); p = datawavePrincipal; drm.setRequiredRoles(getFirstRole()); canRun = drm.canRunQuery(null, p); Assert.assertTrue(canRun); }