Skip to content

Instantly share code, notes, and snippets.

@gaol
Last active March 11, 2022 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaol/7593cebcb2d1328d4ed50ece5ee1ac70 to your computer and use it in GitHub Desktop.
Save gaol/7593cebcb2d1328d4ed50ece5ee1ac70 to your computer and use it in GitHub Desktop.
Should EventBusOptions.setClusterPublicPort(-1) fail ?
@Test
public void testEventBusOptions() {
VertxOptions vertxOptions1 = new VertxOptions();
JsonObject json = vertxOptions1.toJson();
VertxOptions vertxOptions2 = new VertxOptions(json);
assertEquals(json, vertxOptions2.toJson());
}
// ========================
The above test fails with the message:
testEventBusOptions(io.vertx.core.VertxOptionsTest) Time elapsed: 0.338 sec <<< ERROR!
java.lang.IllegalArgumentException: clusterPublicPort p must be in range 0 <= p <= 65535
at io.vertx.core.eventbus.EventBusOptions.setClusterPublicPort(EventBusOptions.java:651)
at io.vertx.core.eventbus.EventBusOptionsConverter.fromJson(EventBusOptionsConverter.java:55)
at io.vertx.core.eventbus.EventBusOptions.<init>(EventBusOptions.java:165)
at io.vertx.core.VertxOptionsConverter.fromJson(VertxOptionsConverter.java:45)
at io.vertx.core.VertxOptions.<init>(VertxOptions.java:181)
at io.vertx.core.VertxOptionsTest.testEventBusOptions(VertxOptionsTest.java:321)
`-1` is the default value for clusterPublicPort, why we cannot set the value to the default one ?
There is also a test that `setClusterPublicPort(-1)` should fail at: https://github.com/eclipse-vertx/vert.x/blob/4.2.5/src/test/java/io/vertx/core/VertxOptionsTest.java#L84-L89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment