Skip to content

Instantly share code, notes, and snippets.

@rpkraemer
Created March 11, 2013 20:35
Show Gist options
  • Select an option

  • Save rpkraemer/5137501 to your computer and use it in GitHub Desktop.

Select an option

Save rpkraemer/5137501 to your computer and use it in GitHub Desktop.
assertContains
// Requer que um elemento em "list" possua alguma string "expected"
protected <T extends Element> void assertContains(List<T> list, String... expected) {
for (Element t : list) {
String name = t.getName();
for (String str : expected)
if (str.equalsIgnoreCase(name)) return ;
}
Assert.fail("list there is no element called " + expected);
}
// Requer que todas as strings "expected" existam em "list"
protected <T extends Element> void assertContains(List<T> list, String... expected) {
:requiredElements
for (String requiredElementName : expected) {
for (Element element : list)
if (requiredElementName.equalsIgnoreCase(element.getName())) continue requiredElements;
Assert.fail("list there is no element called " + requiredElementName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment