[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit WebLinkTest.java,1.25,1.26
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-12-27 13:43:14
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv21436/test/com/meterware/httpunit
Modified Files:
WebLinkTest.java
Log Message:
Added getFragmentIdentifier
Index: WebLinkTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebLinkTest.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- WebLinkTest.java 14 Oct 2002 04:19:06 -0000 1.25
+++ WebLinkTest.java 27 Dec 2002 13:43:11 -0000 1.26
@@ -19,16 +19,8 @@
* DEALINGS IN THE SOFTWARE.
*
*******************************************************************************************************************/
-
-import java.net.URL;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
-import java.util.Vector;
-import java.util.Enumeration;
-
/**
* Tests for the WebLink class.
@@ -43,7 +35,7 @@
}
- public static Test suite() {
+ public static TestSuite suite() {
return new TestSuite( WebLinkTest.class );
}
@@ -58,10 +50,10 @@
defineResource( "SimplePage.html",
"<html><head><title>A Sample Page</title></head>\n" +
"<body>This has no forms but it does\n" +
- "have <a href=\"/other.html\" id=\"activeID\">an <b>active</b> link</A>\n" +
+ "have <a href='/other.html#middle' id='activeID'>an <b>active</b> link</A>\n" +
" and <a name=here>an anchor</a>\n" +
- "<a href=\"basic.html\" name=\"nextLink\"><IMG SRC=\"/images/arrow.gif\" ALT=\"Next -->\" WIDTH=1 HEIGHT=4></a>\n" +
- "<a href=\"another.html\" name=\"myLink\">some text</a>\n" +
+ "<a href='basic.html' name=\"nextLink\"><IMG SRC=\"/images/arrow.gif\" ALT=\"Next -->\" WIDTH=1 HEIGHT=4></a>\n" +
+ "<a href='another.html' name='myLink'>some text</a>\n" +
"</body></html>\n" );
WebConversation wc = new WebConversation();
@@ -151,6 +143,15 @@
link = _simplePage.getLinkWithName( "nextLink" );
assertNotNull( "the image link was not found", link );
assertEquals( "image link URL", getHostPath() + "/basic.html", link.getRequest().getURL().toExternalForm() );
+ }
+
+
+ public void testFragmentIdentifier() throws Exception {
+ WebLink link = (WebLink) _simplePage.getElementWithID( "activeID" );
+ assertNotNull( "the active link was not found", link );
+ assertEquals( "fragment identifier #1", "middle", link.getFragmentIdentifier() );
+
+ assertEquals( "fragment identifier #2", "", _simplePage.getLinks()[1].getFragmentIdentifier() );
}
|