Representation rep = initNaturalLanguageTest(field);
// test de texts
Iterator<Text> deTexts = rep.get(field, "de");
assertNotNull(deTexts);
assertTrue(deTexts.hasNext()); // there is one German text in the test set
Text text = deTexts.next();
assertEquals(text.getLanguage(), "de"); // "de" lang
assertEquals(text.getText(), NL_TEST_de); // the de lang text
assertFalse(deTexts.hasNext());// only one Result
// test en labels (2 results)
Iterator<Text> enTexts = rep.get(field, "en");
assertNotNull(enTexts);
Set<String> textSet = new HashSet<String>(Arrays.asList(NL_TEST_en, NL_TEST_en2));
while (enTexts.hasNext()) {
text = enTexts.next();
assertEquals("en", text.getLanguage());
assertTrue(textSet.remove(text.getText())); // remove the found
}
assertTrue(textSet.isEmpty()); // all texts found
}