PreferenceStorageImpl implements PreferenceStorage { @Override public Collection<String> allKeys(final PreferenceScope scope) { Collection<String> keys = new ArrayList<>(); Path path = this.objectStorage.getPath(buildScopePath(scope)); if (ioService.exists(path)) { walkFileTree(checkNotNull("path", path), new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { try { checkNotNull("file", file); final String fileName = file.getFileName().toString(); final int keyEndIndex = fileName.length() - FILE_FORMAT_SIZE; final String fileNameWithoutFormat = fileName.substring(0, keyEndIndex); keys.add(fileNameWithoutFormat); } catch (final Exception ex) { logger.error("An unexpected exception was thrown: ", ex); return FileVisitResult.TERMINATE; } return FileVisitResult.CONTINUE; } }); } return keys; } protected  PreferenceStorageImpl(); @Inject  PreferenceStorageImpl(@Named("ioStrategy") final IOService ioService,
                                 final SessionInfo sessionInfo,
                                 @Customizable final PreferenceScopeTypes scopeTypes,
                                 final PreferenceScopeFactory scopeFactory,
                                 final ObjectStorage objectStorage,
                                 final SpacesAPI spaces,
                                 final Event<PreferenceUpdatedEvent> preferenceUpdatedEvent); @PostConstruct void init(); @Override boolean exists(final PreferenceScope preferenceScope,
                          final String key); @Override boolean exists(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                          final String key); @Override T read(final PreferenceScope preferenceScope,
                      final String key); @Override T read(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                      final String key); @Override PreferenceScopedValue<T> readWithScope(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                                                      final String key); @Override void write(final PreferenceScope preferenceScope,
                      final String key,
                      final Object value); @Override void delete(final PreferenceScope preferenceScope,
                       final String key); @Override Collection<String> allKeys(final PreferenceScope scope); @Override Collection<String> allKeys(final List<PreferenceScope> scopes); static final String FILE_FORMAT; static final int FILE_FORMAT_SIZE; }
@Test public void allKeysWithNoKeysTest() { final Collection<String> keys = preferenceStorageServiceBackendImpl.allKeys(allUsersEntireApplicationScope); assertNotNull(keys); assertEquals("There should not exist any keys.", 0, keys.size()); }