### Question:
AuthorizationsUtil { public static Set<Authorizations> getDowngradedAuthorizations(String requestedAuths, Principal principal) { if (principal instanceof DatawavePrincipal) { return getDowngradedAuthorizations(requestedAuths, (DatawavePrincipal) principal); } else { return Collections.singleton(new Authorizations()); } }  static Authorizations union(Iterable<byte[]> authorizations1, Iterable<byte[]> authorizations2); static Set<Authorizations> mergeAuthorizations(String requestedAuths, Collection<? extends Collection<String>> userAuths); static Set<Authorizations> getDowngradedAuthorizations(String requestedAuths, Principal principal); static LinkedHashSet<Authorizations> getDowngradedAuthorizations(String requestedAuths, DatawavePrincipal principal); static String downgradeUserAuths(Principal principal, String requested); static List<String> splitAuths(String requestedAuths); static Set<Authorizations> buildAuthorizations(Collection<? extends Collection<String>> userAuths); static String buildAuthorizationString(Collection<? extends Collection<String>> userAuths); static String buildUserAuthorizationString(Principal principal); static Collection<Authorizations> minimize(Collection<Authorizations> authorizations); static Collection<? extends Collection<String>> prepareAuthsForMerge(Authorizations authorizations);  }### Answer:
@Test public void testDowngradeAuthorizations() { HashSet<Authorizations> expected = Sets.newHashSet(new Authorizations("A", "C"), new Authorizations("A", "B", "E"), new Authorizations("A", "F", "G")); assertEquals(expected, AuthorizationsUtil.getDowngradedAuthorizations(methodAuths, principal)); }
@Test public void testUserAuthsFirstInMergedSet() { HashSet<Authorizations> mergedAuths = AuthorizationsUtil.getDowngradedAuthorizations(methodAuths, principal); assertEquals(3, mergedAuths.size()); assertEquals("Merged user authorizations were not first in the return set", new Authorizations("A", "C"), mergedAuths.iterator().next()); }