@Test void assertValidShouldThrowOnZeroPort() { assertThatThrownBy(() -> Port.assertValid(0)) .isInstanceOf(IllegalArgumentException.class); }
public static void assertValid(int port) { Preconditions.checkArgument(isValid(port), "Port should be between 1 and 65535"); }
Port { public static void assertValid(int port) { Preconditions.checkArgument(isValid(port), "Port should be between 1 and 65535"); } }
Port { public static void assertValid(int port) { Preconditions.checkArgument(isValid(port), "Port should be between 1 and 65535"); } Port(int value); }
Port { public static void assertValid(int port) { Preconditions.checkArgument(isValid(port), "Port should be between 1 and 65535"); } Port(int value); static Port of(int portNumber); static int generateValidUnprivilegedPort(); static void assertValid(int port); static boolean isValid(int port); int getValue(); @Override final boolean equals(Object o); @Override final int hashCode(); }
Port { public static void assertValid(int port) { Preconditions.checkArgument(isValid(port), "Port should be between 1 and 65535"); } Port(int value); static Port of(int portNumber); static int generateValidUnprivilegedPort(); static void assertValid(int port); static boolean isValid(int port); int getValue(); @Override final boolean equals(Object o); @Override final int hashCode(); static final int MAX_PORT_VALUE; static final int PRIVILEGED_PORT_BOUND; }