PermissionCacheBuilder { @NotNull PermissionCache build() { checkState(initialized); if (existingNames.isEmpty()) { return EmptyCache.INSTANCE; } if (usePathEntryMap) { Map<String, Collection<PermissionEntry>> pathEntryMap = new HashMap<>(); for (String name : existingNames) { PrincipalPermissionEntries ppe = peCache.getFullyLoadedEntries(store, name); for (Map.Entry<String, Collection<PermissionEntry>> e : ppe.getEntries().entrySet()) { String path = e.getKey(); Collection<PermissionEntry> pathEntries = pathEntryMap.get(path); if (pathEntries == null) { pathEntries = new TreeSet<>(e.getValue()); pathEntryMap.put(path, pathEntries); } else { pathEntries.addAll(e.getValue()); } } } if (pathEntryMap.isEmpty()) { return EmptyCache.INSTANCE; } else { return new PathEntryMapCache(pathEntryMap); } } else { return new DefaultPermissionCache(store, peCache, existingNames); } } PermissionCacheBuilder(@NotNull PermissionStore store);   }
@Test(expected = IllegalStateException.class) public void testBuildBeforeInitialized() { permissionCacheBuilder.build(); }