public void testCustomButtonParser() { // .toLowerCase normalization to keep IE happy assertEquals("<b>click me</b>", StringCase.toLower(widgetUi.pushButton.getUpFace().getHTML())); assertTrue(widgetUi.pushButton.getUpHoveringFace().getHTML().contains(">Click ME!<")); assertEquals( "<b>click me!</b>", StringCase.toLower(widgetUi.pushButton.getUpHoveringFace().getHTML())); // Can't test the images at all :-P }
public void testUiTextWithSafeHtml() { assertEquals( "<b>this text should be bold!</b>", StringCase.toLower(widgetUi.htmlWithComputedSafeHtml.getHTML())); assertEquals( "<b>this text won't be bold!</b>", StringCase.toLower(widgetUi.htmlWithComputedText.getHTML()).replaceAll(">", ">")); assertEquals( "<b>this text won't be bold!</b>", StringCase.toLower(widgetUi.labelWithComputedText.getText())); }
/** * Assert that the expect strings are found in body, and in the order given. WARNING: both body * and expected are normalized to lower case, to get around IE's habit of returning capitalized * DOM elements. */ private void assertInOrder(String body, String... expected) { body = StringCase.toLower(body); int lastIndex = 0; String lastExpected = ""; for (String next : expected) { next = StringCase.toLower(next); int index = body.indexOf(next); assertTrue(body + " should contain " + next, index > -1); assertTrue("Expect " + next + " after " + lastExpected, index > lastIndex); lastIndex = index; } }
public void suppressedForSafari3Fail_testDomTextNoMessageWithFunnyChars() { ParagraphElement p = widgetUi.funnyCharsParagraph; // WebKit does \n replace thing, so let's do it everywhere String t = StringCase.toLower(p.getInnerHTML().replace("\n", " ")); String expected = "Templates can be marked up for <b>localization</b>, which presents alls " + "kinds of exciting opportunities for bugs related to character escaping. " + "Consider these funny characters \\ \" \" ' ' & < > > { }, and " + "the various places they might make your life miserable, like this " + "untranslated paragraph."; expected = StringCase.toLower(expected); assertEquals(expected, t); }
private boolean doKeepAlives() { synchronized (lock) { if (remotes != null) { // If the shutdown thread has already executed, then we can stop this // thread. if (stopped) { return false; } for (SeleniumWrapper remote : remotes) { // Use getTitle() as a cheap way to see if the Selenium server's still // responding (Selenium seems to provide no way to check the server // status directly). try { if (remote.getSelenium() != null) { remote.getSelenium().getTitle(); } } catch (Throwable e) { // If we ask for the title of the page while a new module is // loading, IE will throw a permission denied exception. String message = e.getMessage(); if (message == null || !StringCase.toLower(message).contains("permission denied")) { if (interruptedHosts == null) { interruptedHosts = new HashSet<String>(); } interruptedHosts.add(remote.getSpecifier()); } } } } return interruptedHosts == null; } }
/** * Returns the String represention of the java type for a primitive for example int/Integer, * float/Float. * * @param type * @return the string representation */ protected static String getJavaObjectTypeFor(JPrimitiveType type) { if (type == JPrimitiveType.INT) { return "Integer"; } else { String s = type.getSimpleSourceName(); return StringCase.toUpper(s.substring(0, 1)) + s.substring(1); } }
public void suppressForIEfail_testBizarrelyElementedWidgets() { assertInOrder( StringCase.toLower(widgetUi.widgetCrazyTable.getInnerHTML()), "<td>they have been known</td>", "<td>to write widgets</td>", "<td>that masquerade</td>", "<td>as table cells,</td>", "<td>just like these.</td>", "<td>burma shave</td>"); assertInOrder( widgetUi.widgetCrazyOrderedList.getInnerHTML(), "<li>similar</li>", "<li>things</li>"); assertInOrder( widgetUi.widgetCrazyDefinitionList.getInnerHTML(), "<dt>Being</dt>", "<dd>done</dd>", "<dd>with</dd>", "<dd>lists</dd>"); }
public void testExceptionFailsOnNotSafari() { String agent = StringCase.toLower(getAgent()); if (agent.indexOf("safari") == -1) { throw new RuntimeException("Browser is not Safari."); } }
public void testAssertFailsOnNotSafari() { String agent = StringCase.toLower(getAgent()); if (agent.indexOf("safari") == -1) { fail("Browser is not Safari."); } }
public void testAssertFailsOnNotIE() { String agent = StringCase.toLower(getAgent()); if (agent.indexOf("msie") == -1) { fail("Browser is not IE."); } }
public void testTableWithColumns() { assertEquals("col", StringCase.toLower(domUi.narrowColumn.getTagName())); assertEquals("tr", StringCase.toLower(domUi.tr.getTagName())); assertEquals("th", StringCase.toLower(domUi.th1.getTagName())); assertEquals("th", StringCase.toLower(domUi.th2.getTagName())); }
public void testTableWithExplicitTbody() { assertEquals("tbody", StringCase.toLower(domUi.tbody.getTagName())); assertEquals("th", StringCase.toLower(domUi.th4.getTagName())); }