Posted In: Hamcrest, Junit, Testing

How to unit test a Map – JUnit + Hamcrest

Usecase – You need to unit test Map output and write multiple scenarios to test the data. Hamcrest library may be useful to achieve that Hamcrest 1.3 Classes used from Hamcrest org.hamcrest.collection.IsIn; org.hamcrest.collection.IsMapContaining; Using ErrorCollector so that execution continues even if assert statement fails. Output

Read More


by , on August 12th, 2017

  • Categories