@Test
public void hasElementFailed() {

    when(browser.find(any())).thenThrow(new NoSuchElementException(""));
    try {
        assertThat(browser, CustomMatchers.hasElement(div));
        fail("should fail");
    } catch (AssertionError e) {
        assertThat(e.getMessage(), is(equalTo("\nExpected: browser page contains div\n     but: div is absent")));
    }
}