Advertisement
codeuniv

Hamcrest - methods summary

Apr 1st, 2022
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. Core
  2. anything - always matches, useful if you don't care what the object under test is
  3. describedAs - decorator to adding custom failure description
  4. is - decorator to improve readability - see "Sugar", below
  5. Logical
  6. allOf - matches if all matchers match, short circuits (like Java &&)
  7. anyOf - matches if any matchers match, short circuits (like Java ||)
  8. not - matches if the wrapped matcher doesn't match and vice versa
  9. Object
  10. equalTo - test object equality using Object.equals
  11. hasToString - test Object.toString
  12. instanceOf, isCompatibleType - test type
  13. notNullValue, nullValue - test for null
  14. sameInstance - test object identity
  15. Beans
  16. hasProperty - test JavaBeans properties
  17. Collections
  18. array - test an array's elements against an array of matchers
  19. hasEntry, hasKey, hasValue - test a map contains an entry, key or value
  20. hasItem, hasItems - test a collection contains elements
  21. hasItemInArray - test an array contains an element
  22. Number
  23. closeTo - test floating point values are close to a given value
  24. greaterThan, greaterThanOrEqualTo, lessThan, lessThanOrEqualTo - test ordering
  25. Text
  26. equalToIgnoringCase - test string equality ignoring case
  27. equalToIgnoringWhiteSpace - test string equality ignoring differences in runs of whitespace
  28. containsString, endsWith, startsWith - test string matching
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement