@Test
public void hasElementNTimesFailed() {

    when(browser.numberOfAppearances(div)).thenReturn(2);
    when(browser.findPageWithNumberOfOccurrences(eq(div), eq(5), eq(exactly))).thenThrow(new NoSuchElementException(""));
    try {
        assertThat(browser, CustomMatchers.hasElements(div).present(5).times());
        fail("should fail");
    } catch (AssertionError e) {
        assertThat(e.getMessage(), is(equalTo("\nExpected: browser page contains div 5 times\n     but: div appears 2 times")));
    }
}