Skip to content

Commit 2a63ec4

Browse files
committed
Update AbstractArtifactResourceResolverTest.java
1 parent 5cc9392 commit 2a63ec4

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

microsphere-java-core/src/test/java/io/microsphere/classloading/AbstractArtifactResourceResolverTest.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ public final void testGetPriority() {
7474
public void testResolve() throws Throwable {
7575
testResolveOnFile();
7676
testResolveOnDirectory();
77+
testResolveOnInvalidDirectory();
78+
testResolveOnResource();
7779
testResolveOnNull();
7880
}
7981

@@ -85,6 +87,20 @@ protected void testResolveOnDirectory() throws Throwable {
8587
assertArtifact(AbstractArtifactResourceResolverTest.class);
8688
}
8789

90+
protected void testResolveOnInvalidDirectory() throws Throwable {
91+
URL resourceURL = resolveResourceURL(AbstractArtifactResourceResolver.class);
92+
assertNull(this.resolver.resolve(resourceURL));
93+
}
94+
95+
protected void testResolveOnResource() throws Throwable {
96+
URL resourceURL = new URL("http://localhost/not-found/");
97+
assertNull(this.resolver.resolve(resourceURL));
98+
}
99+
100+
protected void testResolveOnNull() throws Throwable {
101+
assertNull(this.resolver.resolve(null));
102+
}
103+
88104
void assertArtifact(Class<?> targetClass) throws Throwable {
89105
URL resourceURL = resolveResourceURL(targetClass);
90106
Artifact artifact = this.resolver.resolve(resourceURL);
@@ -97,10 +113,6 @@ URL resolveResourceURL(Class<?> targetClass) throws MalformedURLException {
97113
return archiveFile.toURI().toURL();
98114
}
99115

100-
protected void testResolveOnNull() throws Throwable {
101-
assertNull(this.resolver.resolve(null));
102-
}
103-
104116

105117
protected abstract void assertArtifact(Artifact artifact) throws Throwable;
106118

0 commit comments

Comments
 (0)