### Question:
AuthorizationsUtil { public static Collection<Authorizations> minimize(Collection<Authorizations> authorizations) { return AuthorizationsMinimizer.minimize(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 testMinimizeWithSubset() { ArrayList<Authorizations> authSets = Lists.newArrayList(new Authorizations("A", "B", "C", "D"), new Authorizations("C", "B"), new Authorizations("A", "B", "C"), new Authorizations("B", "C", "D", "E")); Collection<Authorizations> expected = Collections.singleton(new Authorizations("B", "C")); assertEquals(expected, AuthorizationsUtil.minimize(authSets)); }
@Test public void testMinimizeWithNoSubset() { LinkedHashSet<Authorizations> expected = new LinkedHashSet<>(); expected.add(new Authorizations("A", "B", "C", "D")); expected.add(new Authorizations("B", "C", "F")); expected.add(new Authorizations("A", "B", "E")); expected.add(new Authorizations("B", "C", "D", "E")); assertEquals(expected, AuthorizationsUtil.minimize(expected)); }
@Test public void testMinimizeWithMultipleSubsets() { LinkedHashSet<Authorizations> testSet = new LinkedHashSet<>(); testSet.add(new Authorizations("A", "B", "C", "D")); testSet.add(new Authorizations("B", "C")); testSet.add(new Authorizations("A", "B", "E")); testSet.add(new Authorizations("A", "B", "D", "E")); LinkedHashSet<Authorizations> expected = new LinkedHashSet<>(); expected.add(new Authorizations("B", "C")); expected.add(new Authorizations("A", "B", "E")); assertEquals(expected, AuthorizationsUtil.minimize(testSet)); }
@Test public void testMinimizeWithDupsButNoSubset() { ArrayList<Authorizations> authSets = Lists.newArrayList(new Authorizations("A", "B", "C", "D"), new Authorizations("B", "C", "F"), new Authorizations( "A", "B", "C", "D"), new Authorizations("B", "C", "D", "E")); LinkedHashSet<Authorizations> expected = new LinkedHashSet<>(); expected.add(new Authorizations("A", "B", "C", "D")); expected.add(new Authorizations("B", "C", "F")); expected.add(new Authorizations("B", "C", "D", "E")); assertEquals(expected, AuthorizationsUtil.minimize(authSets)); }