@Override
    public Optional<JavaClass> tryResolve(String typeName) {
        String typeFile = typeName.replace(".", "/") + ".class";

        Optional<URI> uri = tryGetUriOf(typeFile);

        return uri.isPresent() ? classUriImporter.tryImport(uri.get()) : Optional.empty();
    }
@Test
    @UseDataProvider("urls_with_spaces")
    public void is_resilient_against_wrongly_encoded_ClassLoader_resource_URLs(URL urlReturnedByClassLoader, URI expectedUriDerivedFromUrl) {
        // it seems like some OSGI ClassLoaders incorrectly return URLs with unencoded spaces.
        // This lead to `url.toURI()` throwing an exception -> https://github.com/TNG/ArchUnit/issues/683
        verifyUrlCannotBeConvertedToUriInTheCurrentForm(urlReturnedByClassLoader);

        JavaClass expectedJavaClass = importClassWithContext(Object.class);
        when(uriImporter.tryImport(expectedUriDerivedFromUrl)).thenReturn(Optional.of(expectedJavaClass));

        Optional<JavaClass> resolvedClass = withMockedContextClassLoader(classLoaderMock -> {
            String typeNameFromUrlWithSpaces = "some.TypeFromUrlWithSpaces";
            String typeResourceFromUrlWithSpaces = typeNameFromUrlWithSpaces.replace(".", "/") + ".class";
            when(classLoaderMock.getResource(typeResourceFromUrlWithSpaces)).thenReturn(urlReturnedByClassLoader);

            return resolver.tryResolve(typeNameFromUrlWithSpaces);
        });

        assertThat(resolvedClass).contains(expectedJavaClass);
    }