Details
-
Improvement
-
Status: Triage Needed
-
Normal
-
Resolution: Unresolved
-
None
-
None
-
All
-
None
Description
This does not work
try (Cluster ignored = build(1) .withConfig(c -> c.with(Feature.NETWORK, Feature.NATIVE_PROTOCOL, Feature.GOSSIP) .set("some_property_which_throws_when_misconfigured", value)) .start()) { fail("should throw ConfigurationException"); } catch (Exception ex) { assertEquals(ConfigurationException.class, ex.getClass()); }
Because ConfigurationException is not shared so it looks like it doesn't match.
this is workaround
Predicate<String> EXTRA = className -> className.equals(ConfigurationException.class.getName()); Cluster.Builder builder = build(1); assertThatThrownBy(() -> builder .withSharedClasses(EXTRA.or(builder.getSharedClasses())) .start()) .isInstanceOf(ConfigurationException.class);
But to have it nice and clean like this, it would require us to share all exceptions, to add them to "DEFAULT_SHARED_PACKAGES". in "org.apache.cassandra.distributed.shared.InstanceClassLoader".
assertThatThrownBy(() -> build(1).withConfig(c -> c.set("some_property_which_throws_when_misconfigured", value)).start())
.isInstanceOf(ConfigurationException.class);
We could just put all package there.
This would require release of in-jvm dtest api.