TypeOfAddress { public byte toByte() { return toByte(this); } TypeOfAddress(Ton ton, Npi npi); Ton getTon(); void setTon(Ton ton); Npi getNpi(); void setNpi(Npi npi); byte toByte(); static byte toByte(TypeOfAddress toa); static TypeOfAddress valueOf(byte b); @Override String toString();  }
@Test public void toByte() { TypeOfAddress toa = new TypeOfAddress(Ton.INTERNATIONAL, Npi.ISDN); Assert.assertEquals((byte)0x91, toa.toByte()); }
@Test public void toByte2() { TypeOfAddress toa = new TypeOfAddress(Ton.UNKNOWN, Npi.UNKNOWN); Assert.assertEquals((byte)0x80, toa.toByte()); }