@Test void generateValidUnprivilegedPortShouldReturnAValidPort() { assertThat(Port.generateValidUnprivilegedPort()) .isBetween(Port.PRIVILEGED_PORT_BOUND, Port.MAX_PORT_VALUE); }
public static int generateValidUnprivilegedPort() { return ThreadLocalRandom.current().nextInt(Port.MAX_PORT_VALUE - PRIVILEGED_PORT_BOUND) + PRIVILEGED_PORT_BOUND; }
Port { public static int generateValidUnprivilegedPort() { return ThreadLocalRandom.current().nextInt(Port.MAX_PORT_VALUE - PRIVILEGED_PORT_BOUND) + PRIVILEGED_PORT_BOUND; } }
Port { public static int generateValidUnprivilegedPort() { return ThreadLocalRandom.current().nextInt(Port.MAX_PORT_VALUE - PRIVILEGED_PORT_BOUND) + PRIVILEGED_PORT_BOUND; } Port(int value); }
Port { public static int generateValidUnprivilegedPort() { return ThreadLocalRandom.current().nextInt(Port.MAX_PORT_VALUE - PRIVILEGED_PORT_BOUND) + PRIVILEGED_PORT_BOUND; } 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 int generateValidUnprivilegedPort() { return ThreadLocalRandom.current().nextInt(Port.MAX_PORT_VALUE - PRIVILEGED_PORT_BOUND) + PRIVILEGED_PORT_BOUND; } 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; }