public void test_Protocol_value() { // a regular one assertEquals(KEYRecord.Protocol.IPSEC, KEYRecord.Protocol.value("IPSEC")); // a unassigned value within range assertEquals(254, KEYRecord.Protocol.value("254")); // too low assertEquals(-1, KEYRecord.Protocol.value("-2")); // too high assertEquals(-1, KEYRecord.Protocol.value("256")); }
public void test_Protocol_string() { // a regular one assertEquals("DNSSEC", KEYRecord.Protocol.string(KEYRecord.Protocol.DNSSEC)); // a unassigned value within range assertEquals("254", KEYRecord.Protocol.string(0xFE)); // too low try { KEYRecord.Protocol.string(-1); fail("IllegalArgumentException not thrown"); } catch (IllegalArgumentException e) { } // too high try { KEYRecord.Protocol.string(0x100); fail("IllegalArgumentException not thrown"); } catch (IllegalArgumentException e) { } }