ctubbsii commented on code in PR #35:
URL:
https://github.com/apache/accumulo-classloaders/pull/35#discussion_r2628551238
##########
modules/local-caching-classloader/src/test/java/org/apache/accumulo/classloader/lcc/LocalCachingContextClassLoaderFactoryTest.java:
##########
@@ -269,36 +271,39 @@ public void testInitialNonExistentResource() throws
Exception {
"InitialContextDefinitionFileMissingResource.json", def.toJson());
final URL initialDefUrl = new URL(fs.getUri().toString() +
initial.toUri().toString());
- ContextClassLoaderException ex =
assertThrows(ContextClassLoaderException.class,
+ var ex = assertThrows(ContextClassLoaderException.class,
() -> FACTORY.getClassLoader(initialDefUrl.toString()));
assertTrue(ex.getMessage().endsWith("jarACopy.jar does not exist."));
}
@Test
public void testInitialBadResourceURL() throws Exception {
- // remove the file:// prefix from the URL
- Resource r = new Resource(jarAOrigLocation.toString().substring(6),
"1234");
LinkedHashSet<Resource> resources = new LinkedHashSet<>();
- resources.add(r);
+ resources.add(new Resource(jarAOrigLocation, "1234"));
- ContextDefinition def = new ContextDefinition("initial",
MONITOR_INTERVAL_SECS, resources);
+ // remove the file:// prefix from the URL
+ String goodJson = new ContextDefinition("initial", MONITOR_INTERVAL_SECS,
resources).toJson();
+ String badJson =
+ goodJson.replace(jarAOrigLocation.toString(),
jarAOrigLocation.toString().substring(6));
+ assertNotEquals(goodJson, badJson);
Review Comment:
No. Correct, you can't create an invalid URL, so I modify the JSON after it
is serialized.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]