version 1.1.1.4, 1999/09/30 11:08:46 |
version 1.1.1.5, 1999/09/30 11:12:37 |
|
|
|
|
|
try { |
try { |
String result = "My known input"; |
String result = "My known input"; |
PageSaver.save(result); |
PageSaver.save("AnyName", result); |
|
|
String servletName = PageSaver.class.getName(); |
String servletName = PageSaver.class.getName(); |
String actualResponse = getServerResponse("http://127.0.0.1:"+PORT_STRING+"/servlet/"+servletName); |
String actualResponse = |
|
getServerResponse("http://127.0.0.1:"+PORT_STRING+"/servlet/"+servletName |
|
+ "?name=AnyName"); |
assert(actualResponse.equals(result)); |
assert(actualResponse.equals(result)); |
} |
} |
catch (Exception exception) { |
catch (Exception exception) { |
|
|
|
assert("General exceptions should not occur.",false); |
assert("General exceptions should not occur.",false); |
} |
} |
} |
} |
public void testLinkRendering() |
/** |
{ |
* Exercise the PageSaver |
|
* Send a request and check the response contains the expected String. |
|
*/ |
|
public void testGetEditingUrl() { |
try { |
try { |
String result = "I hate _Microsoft_"; |
String result = "Myknowninput"; |
|
|
PageSaver.save(result); |
String servletName = PageSaver.class.getName(); |
|
|
String actualResponse = getServerResponse("http://127.0.0.1:"+PORT_STRING+"/servlet/"+ PageSaver.class.getName()); |
String actualResponse = |
assert(actualResponse.equals("I hate <a href=\"/servlet/" |
getServerResponse("http://127.0.0.1:" + PORT_STRING |
+PageSaver.class.getName() |
+ "/servlet/" + servletName |
+"?page=Microsoft\">Microsoft</a>")); |
+ "?name=AnyName" |
|
+"&edit="); |
|
assert(actualResponse.equals(PageSaver.makeEditForm(result))); |
} |
} |
catch (Exception exception) { |
catch (Exception exception) { |
exception.printStackTrace(); |
exception.printStackTrace(); |
|
|
|
* Exercise the PageSaver |
* Exercise the PageSaver |
* Send a request and check the response contains the expected String. |
* Send a request and check the response contains the expected String. |
*/ |
*/ |
public void XtestSaving() |
public void testSaving() |
{ |
{ |
|
|
try { |
try { |
String result = "Myknowninput"; |
String result = "Myknowninput"; |
|
|
String servletName = PageSaver.class.getName(); |
String servletName = PageSaver.class.getName(); |
getServerResponse("http://127.0.0.1:"+PORT_STRING+"/servlet/"+servletName+"?save="+result); |
getServerResponse("http://127.0.0.1:"+PORT_STRING+"/servlet/"+servletName |
|
+ "?name=AnyName" |
String actualResponse = getServerResponse("http://127.0.0.1:"+PORT_STRING+"/servlet/"+servletName); |
+"&save="+result); |
|
|
|
String actualResponse = |
|
getServerResponse("http://127.0.0.1:"+PORT_STRING+"/servlet/"+servletName |
|
+ "?name=AnyName"); |
assert(actualResponse.equals(result)); |
assert(actualResponse.equals(result)); |
} |
} |
catch (Exception exception) { |
catch (Exception exception) { |
|
|
|
assert("General exceptions should not occur.",false); |
assert("General exceptions should not occur.",false); |
} |
} |
} |
} |
|
public void testSavingNamedPage() { |
|
try { |
|
String result = "Myknowninput"; |
|
String pageName = "PageOne"; |
|
String servletName = PageSaver.class.getName(); |
|
getServerResponse("http://127.0.0.1:" + PORT_STRING + "/servlet/" + servletName |
|
+ "?name=" + pageName |
|
+ "&save=" + result); |
|
|
|
String result2 = "Myknowninput2"; |
|
String pageName2 = "PageTwo"; |
|
getServerResponse("http://127.0.0.1:" + PORT_STRING + "/servlet/" + servletName |
|
+ "?name=" + pageName2 |
|
+ "&save=" + result2); |
|
|
|
String actualResponse = getServerResponse("http://127.0.0.1:" + PORT_STRING + "/servlet/" |
|
+ servletName |
|
+ "?name=" + pageName); |
|
assert("Expected first page response",actualResponse.equals(result)); |
|
} |
|
catch (Exception exception) { |
|
exception.printStackTrace(); |
|
assert("General exceptions should not occur.", false); |
|
} |
|
} |
} |
} |