private static URL ensureFileUrl(final URL resource) {
    Preconditions.checkNotNull(resource);
    try {
      try {
        Paths.get(resource.toURI());
      } catch (final FileSystemNotFoundException e) {
        final Path target = Files.createTempFile("besu", null);
        target.toFile().deleteOnExit();
        Files.copy(resource.openStream(), target, StandardCopyOption.REPLACE_EXISTING);
        return target.toUri().toURL();
      }
    } catch (final IOException | URISyntaxException e) {
      throw new RuntimeException(e);
    }
    return resource;
  }
Take a resource URL and if needed copy it to a temp file and return that URL.
testutil/src/main/java/org/hyperledger/besu/testutil/BlockTestUtil.java