use of org.minidns.record.TXT in project minidns by MiniDNS.
the class DNSMessageTest method testTXTLookup.
@Test
public void testTXTLookup() throws Exception {
DNSMessage m = getMessageFromResource("codinghorror-txt");
HashSet<String> txtToBeFound = new HashSet<>();
txtToBeFound.add("google-site-verification=2oV3cW79A6icpGf-JbLGY4rP4_omL4FOKTqRxb-Dyl4");
txtToBeFound.add("keybase-site-verification=dKxf6T30x5EbNIUpeJcbWxUABJEnVWzQ3Z3hCumnk10");
txtToBeFound.add("v=spf1 include:spf.mandrillapp.com ~all");
List<Record<? extends Data>> answers = m.answerSection;
for (Record<? extends Data> r : answers) {
assertCsEquals("codinghorror.com", r.name);
Data d = r.getPayload();
assertTrue(d instanceof TXT);
assertEquals(TYPE.TXT, d.getType());
TXT txt = (TXT) d;
assertTrue(txtToBeFound.contains(txt.getText()));
txtToBeFound.remove(txt.getText());
}
assertEquals(txtToBeFound.size(), 0);
}