public void testFailure() {
    selenium.setContext(
        "A real negative test, using the real Selenium on the browser side served by Jetty, driven from Java",
        SeleniumLogLevels.DEBUG);
    selenium.open("/selenium-server/tests/html/test_click_page1.html");
    String badElementName = "This element doesn't exist, so Selenium should throw an exception";
    try {
      selenium.getText(badElementName);
      fail("No exception was thrown!");
    } catch (SeleniumException se) {
      assertTrue(
          "Exception message isn't as expected: " + se.getMessage(),
          se.getMessage().indexOf(badElementName + " not found") != -1);
    }

    try {
      assertTrue(
          "Negative test", selenium.isTextPresent("Negative test: verify non-existent text"));
      fail("No exception was thrown!");
    } catch (AssertionFailedError se) {
      assertTrue(
          "Exception message isn't as expected: " + se.getMessage(),
          se.getMessage().indexOf("Negative test") != -1);
    }
  }