How to verify Map size using Hamcrest

The good news

There is a matcher that does exactly what you want in the current master branch of the JavaHamcrest project.
You can call it like so:

assertThat(mapMap, aMapWithSize(1));

And the bad news

Unfortunately this matcher is not in the latest release of Hamcrest (1.3).

[Update] And finally the very good news

The aforementioned matcher is included in the newly released version 2.1.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)