### Question:
PrincipalClassifier { public static Set<String> getPatronPrincipals(Set<String> principals) { return principals.stream() .filter(agent -> PATRON_PRINC_PATTERN.matcher(agent).matches()) .collect(Collectors.toSet()); } private  PrincipalClassifier(); static boolean isPatronPrincipal(String principal); static void classifyPrincipals(Set<String> principals, Set<String> patronPrincipals,
            Set<String> staffPrincipals); static Set<String> getPatronPrincipals(Set<String> principals);  }### Answer:
@Test public void getPatronPrincipalsTest() { Set<String> principals = new HashSet<>(Arrays.asList(PUBLIC_PRINC, AUTHENTICATED_PRINC, STAFF_PRINC)); Set<String> patronPrincipals = getPatronPrincipals(principals); assertEquals(2, patronPrincipals.size()); assertTrue(patronPrincipals.contains(PUBLIC_PRINC)); assertTrue(patronPrincipals.contains(AUTHENTICATED_PRINC)); }
@Test public void getPatronPrincipalsNoPatronsTest() { Set<String> principals = new HashSet<>(Arrays.asList(STAFF_PRINC)); Set<String> patronPrincipals = getPatronPrincipals(principals); assertEquals(0, patronPrincipals.size()); }