Author: ozizka(a)redhat.com
Date: 2009-04-30 20:56:53 -0400 (Thu, 30 Apr 2009)
New Revision: 370
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ApplicationsPageTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
Added <HtmlElement> in front of Page#getHtmlElementById(), for the case we switched
to HTMLUnit 2.4+
EJTT - handled NPE in NavTreeNode#getArrowLink()
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ApplicationsPageTest.java
===================================================================
---
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ApplicationsPageTest.java 2009-04-30
18:56:04 UTC (rev 369)
+++
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ApplicationsPageTest.java 2009-05-01
00:56:53 UTC (rev 370)
@@ -88,7 +88,8 @@
String fileSrcPath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
String destDir = ejtt.getTempDir() + "/appPagination";
- if( ! new File(destDir).mkdirs() )
+ new File(destDir).mkdirs();
+ if( ! new File(destDir).isDirectory() )
throw new EmbJoprTestException("Coundn't create directory: "+destDir);
// Deploy the same APP multiple times.
@@ -173,8 +174,9 @@
String fileSrcPath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
String destDir = ejtt.getTempDir() + "/appPagination";
- if( ! new File(destDir).mkdirs() )
- throw new EmbJoprTestException("Coundn't create directory: "+destDir);
+ new File(destDir).mkdirs();
+ if( ! new File(destDir).isDirectory() )
+ throw new EmbJoprTestException("Couldn't create directory: "+destDir);
// Deploy the same APP multiple times.
for (int i = 0; i < 8; i++) {
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-04-30
18:56:04 UTC (rev 369)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-05-01
00:56:53 UTC (rev 370)
@@ -824,7 +824,7 @@
page = (HtmlPage) page.refresh();
// Get the counter number.
- Integer count1 =
NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+ Integer count1 =
NumberUtils.createInteger(page.getBody().<HtmlElement>getHtmlElementById("count").getTextContent());
@@ -874,7 +874,7 @@
assertTrue(page.asText().contains("HELLO WORLD"));
// Get the counter number.
- Integer count2 =
NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+ Integer count2 =
NumberUtils.createInteger(page.getBody().<HtmlElement>getHtmlElementById("count").getTextContent());
assertTrue( "Counter is reset upon app restart, thus should be lower
after.", count1 > count2 );
@@ -932,7 +932,7 @@
page = (HtmlPage) page.refresh();
// Get the counter number.
- Integer count1 =
NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+ Integer count1 =
NumberUtils.createInteger(page.getBody().<HtmlElement>getHtmlElementById("count").getTextContent());
@@ -962,7 +962,7 @@
assertTrue(page.asText().contains("HELLO WORLD"));
// Get the counter number.
- Integer count2 =
NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+ Integer count2 =
NumberUtils.createInteger(page.getBody().<HtmlElement>getHtmlElementById("count").getTextContent());
assertTrue( "Counter is reset upon app restart, thus should be lower
after.", count1 > count2 );
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-04-30
18:56:04 UTC (rev 369)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-05-01
00:56:53 UTC (rev 370)
@@ -880,7 +880,7 @@
page = (HtmlPage) page.refresh();
// Get the counter number.
- String count1text =
page.getBody().getHtmlElementById("count").getTextContent();
+ String count1text =
page.getBody().<HtmlElement>getHtmlElementById("count").getTextContent();
Integer count1 = NumberUtils.createInteger( count1text );
@@ -925,7 +925,7 @@
assertTrue(page.asText().contains("HELLO WORLD"));
// Get the counter number.
- String count2text =
page.getBody().getHtmlElementById("count").getTextContent();
+ String count2text =
page.getBody().<HtmlElement>getHtmlElementById("count").getTextContent();
Integer count2 = NumberUtils.createInteger( count2text );
assertTrue( "Counter is reset upon app restart, thus should be lower after.
" +
@@ -980,7 +980,7 @@
page = (HtmlPage) page.refresh();
// Get the counter number.
- String count1text =
page.getBody().getHtmlElementById("count").getTextContent();
+ String count1text =
page.getBody().<HtmlElement>getHtmlElementById("count").getTextContent();
Integer count1 = NumberUtils.createInteger( count1text );
@@ -1008,7 +1008,7 @@
assertTrue(page.asText().contains("HELLO WORLD"));
// Get the counter number.
- String count2text =
page.getBody().getHtmlElementById("count").getTextContent();
+ String count2text =
page.getBody().<HtmlElement>getHtmlElementById("count").getTextContent();
Integer count2 = NumberUtils.createInteger( count2text );
assertTrue( "Counter is reset upon app restart, thus should be lower after.
" +
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
---
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-04-30
18:56:04 UTC (rev 369)
+++
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-05-01
00:56:53 UTC (rev 370)
@@ -399,9 +399,12 @@
}
/** Returns the arrow's link. */
- public HtmlAnchor getArrowLink(){
+ public HtmlAnchor getArrowLink() throws HtmlElementNotFoundException{
String xPath =
".//td[contains(@id,':handles')]//a[contains(@id,':handle')]";
- return (HtmlAnchor) this.elem.getFirstByXPath( xPath );
+ HtmlAnchor arrowLink = (HtmlAnchor) this.elem.getFirstByXPath( xPath );
+ if( null == arrowLink )
+ throw new HtmlElementNotFoundException("Arrow link not found using XPath:
"+xPath, currentTest);
+ return arrowLink;
}
/** Clicks the link of the this node. */
Show replies by date