public boolean fileIsInAllowedPath(Path path) {
        if (allowedPaths.isEmpty()) {
            return true;
        }

        final Path realFilePath = resolveRealPath(path);
        if (realFilePath == null) {
            return false;
        }
        for (Path allowedPath : allowedPaths) {
            final Path realAllowedPath = resolveRealPath(allowedPath);
            if (realAllowedPath != null && realFilePath.startsWith(realAllowedPath)) {
                return true;
            }
        }
        return false;
    }
@Test
    public void verifyToRealPathCalled() throws IOException {
        final Path permittedPath = mock(Path.class);
        final Path filePath = mock(Path.class);

        pathChecker = new AllowedAuxiliaryPathChecker(new TreeSet<>(Collections.singleton(permittedPath)));
        when(filePath.toRealPath()).thenReturn(filePath);
        pathChecker.fileIsInAllowedPath(filePath);
        verify(permittedPath, times(1)).toRealPath();
        verify(filePath, times(1)).toRealPath();
    }