use of org.minidns.record.NSEC in project minidns by MiniDNS.
the class DNSMessageTest method testExampleNsecLookup.
@Test
public void testExampleNsecLookup() throws Exception {
DNSMessage m = getMessageFromResource("example-nsec");
List<Record<? extends Data>> answers = m.answerSection;
assertEquals(1, answers.size());
assertEquals(TYPE.NSEC, answers.get(0).type);
assertEquals(TYPE.NSEC, answers.get(0).payloadData.getType());
NSEC nsec = (NSEC) answers.get(0).getPayload();
assertCsEquals("www.example.com", nsec.next);
ArrayList<TYPE> types = new ArrayList<>(Arrays.asList(TYPE.A, TYPE.NS, TYPE.SOA, TYPE.TXT, TYPE.AAAA, TYPE.RRSIG, TYPE.NSEC, TYPE.DNSKEY));
for (TYPE type : nsec.types) {
assertTrue(types.remove(type));
}
assertTrue(types.isEmpty());
}