PermissionEntryCache { void load(@NotNull PermissionStore store, @NotNull Collection<PermissionEntry> ret, @NotNull String principalName, @NotNull String path) { if (entries.containsKey(principalName)) { PrincipalPermissionEntries ppe = entries.get(principalName); Collection<PermissionEntry> pes = ppe.getEntriesByPath(path); if (ppe.isFullyLoaded() || pes != null) { if (pes != null) { ret.addAll(pes); } } else { pes = store.load(principalName, path); if (pes == null) { ppe.rememberNotAccessControlled(path); } else { ppe.putEntriesByPath(path, pes); ret.addAll(pes); } } } else { log.error("Failed to load entries for principal '{}' at path {}", principalName, path); } }    }
@Test public void testLoadMissingInit() { ppe.setFullyLoaded(true); when(store.load("a")).thenReturn(ppe); Collection<PermissionEntry> result = new TreeSet<>(); cache.load(store, result, "a", "/path"); assertTrue(result.isEmpty()); }