CugPolicyImpl implements CugPolicy { Iterable<String> getPrincipalNames() { return Sets.newHashSet(principals.keySet()); } CugPolicyImpl(@NotNull String oakPath, @NotNull NamePathMapper namePathMapper,
                  @NotNull PrincipalManager principalManager, int importBehavior, @NotNull CugExclude cugExclude);   CugPolicyImpl(@NotNull String oakPath, @NotNull NamePathMapper namePathMapper,
                  @NotNull PrincipalManager principalManager, int importBehavior,
                  @NotNull CugExclude cugExclude, @NotNull Iterable<Principal> principals, boolean immutable); @NotNull @Override Set<Principal> getPrincipals(); @Override boolean addPrincipals(@NotNull Principal... principals); @Override boolean removePrincipals(@NotNull Principal... principals); @Override String getPath();  }
@Test public void testGetPrincipalNames() { CugPolicyImpl cug = createCugPolicy(principals); Iterator<String> it = cug.getPrincipalNames().iterator(); assertTrue(it.hasNext()); assertEquals("test", it.next()); assertFalse(it.hasNext()); }
@Test public void testGetPrincipalNames2() { CugPolicyImpl empty = createEmptyCugPolicy(); assertFalse(empty.getPrincipalNames().iterator().hasNext()); }
@Test public void testExcludedPrincipalAddedBefore() { Principal excluded = getExcludedPrincipal(); CugPolicyImpl cug = createCugPolicy(ImportBehavior.ABORT, Collections.singleton(excluded)); assertTrue(Iterables.contains(cug.getPrincipalNames(), excluded.getName())); }