Hamcrest matchers

  • Hamcrest collections:
    • Package: org.hamcrest.collection
      • Javadoc: http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/collection/package-summary.html
      • Check not empty collections:
assertThat(someCollection, not(IsEmptyCollection.empty()));
  • Pacakge: org.hamcrest.core:
    • IsCollectionContaining.hasItem:
assertThat(list, hasItem(item));

 

Leave a Reply