Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) ListViewMatchers: Add isEmpty(). #251

Merged
merged 2 commits into from
Mar 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ atlassian*.xml

# test screenshots.
screenshot*.png

# ctags
tags

Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ public static Matcher<Node> hasItems(int amount) {
return typeSafeMatcher(ListView.class, descriptionText, node -> hasItems(node, amount));
}

@Factory
@Unstable(reason = "is missing apidocs")
public static Matcher<Node> isEmpty() {
String descriptionText = "is empty (has no items)";
return typeSafeMatcher(ListView.class, descriptionText, ListViewMatchers::isListEmpty);
}

//---------------------------------------------------------------------------------------------
// PRIVATE STATIC METHODS.
//---------------------------------------------------------------------------------------------
Expand All @@ -80,4 +87,8 @@ private static boolean hasCellValue(Cell cell,
return !cell.isEmpty() && Objects.equals(cell.getItem(), value);
}

private static boolean isListEmpty(ListView listView) {
return listView.getItems().isEmpty();
}

}