AmsPort extends UnsignedShortLEByteValue { public static AmsPort of(byte... values) { return new AmsPort(values); } private  AmsPort(byte... value); private  AmsPort(int value); static AmsPort of(byte... values); static AmsPort of(int port); static AmsPort of(String port); static AmsPort of(ByteBuf byteBuf); @Override String toString(); static final Pattern AMS_PORT_PATTERN; static final int NUM_BYTES; }
@Test(expected = IllegalArgumentException.class) public void noStrings() { AmsPort.of("port20"); }
@Test(expected = IllegalArgumentException.class) public void noHex() { AmsPort.of("0x0100"); }
@Test public void ofString() { assertByte(AmsPort.of("1"), "0x0100"); }
@Test public void ofInt() { assertByte(AmsPort.of(1), "0x0100"); assertByte(AmsPort.of(65535), "0xffff"); assertThrows(IllegalArgumentException.class, () -> AmsPort.of(-1)); assertThrows(IllegalArgumentException.class, () -> AmsPort.of(65536)); }