package cs221.groupk.common;
import java.io.*;
/**
* UserModuleTestHarness tests and outputs to file the results of testing each
* method and contructor with all valid combinations of parameters.
*
* <P><P>
* <table border="1" cellpadding="3" cellspacing="0" width="100%">
* <tr bgcolor="#CCCCFF" class="TableHeadingColor">
* <td colspan=3><font size="+2"><B>Version History</B></font></td>
* </tr>
* <tr bgcolor="white" class="TableRowColor">
* <td align="right" valign="top" width="11%">
* <div align="center"><font size="+1">Version No.</font></div>
* </td>
* <td width="7%">
* <div align="center"><font size="+1">Author</font></div>
* </td>
* <td width="74%"><font size="+1">Description of changes.</font></td>
* </tr>
* <tr bgcolor="white" class="TableRowColor">
* <td align="right" valign="top" width="11%">
* <div align="center"><font size="-1">0.1 - 01/12/00</font></div>
* </td>
* <td width="15%">
* <div align="center"><a href="mailto:[email protected]">Paul Smith</a></div>
* </td>
* <td width="74%">
* <div align="left">Initial development</div>
* </td>
* </tr>
* </table>
* <P>
* <HR>
* <P>
* View <A HREF="..\..\..\docs\cs221\groupk\common\UserTestSource.html">source code</A>.<P>
* View <A HREF="..\..\..\docs\cs221\groupk\common\UserTestResults.html">test results</A>.<P>
* <HR>
* @see User
* @author <A HREF="mailto:[email protected]">Paul Smith</A>
*/
public class UserModuleTestHarness extends ModuleTestHarness
{
/**CLASS_TESTED the author string written to the output file*/
protected static final String CLASS_TESTED = "User.class";
/**CLASS_AUTHOR the author string written to the output file*/
protected static final String CLASS_AUTHOR = "Paul Smith";
/**FILE_OUTPUT is the filename the tests are saved to*/
protected static final String FILE_OUTPUT = "UserModuleTestHarness.test";
protected User user;
public UserModuleTestHarness()
{
super(CLASS_TESTED, CLASS_AUTHOR, FILE_OUTPUT);
}
public void test() throws IOException
{
out.write("UserModuleTestHarness - Paul Smith.\n\n");
out.write("#########\n#Test 01#\n#########\n");
out.write("Instantise User with default Constructor.\ntoString returns:\n");
user = new User();
out.write(user.toString() + "\n\n");
out.write("#########\n#Test 02#\n#########\n");
out.write("Instantise User with over-loaded Constructor.\nParameters passed:\n"+
"\tuserID: pms9\n"+
"\tname: Paul Smith\n"+
"\tpassword: none set\n"+
"\tadmin: false\n"+
"\ttop: false\n"+
"\tbottom: false\n\ntoString() returns:\n");
user = new User("pms9", "Paul Smith", "none set", false, false, false);
out.write(user.toString() + "\n\n");
out.write("#########\n#Test 03#\n#########\n");
out.write("Instantise User with over-loaded Constructor.\nParameters passed:\n"+
"\tuserID: pms9\n"+
"\tname: Paul Smith\n"+
"\tpassword: none set\n"+
"\tadmin: true\n"+
"\ttop: false\n"+
"\tbottom: false\n\ntoString() returns:\n");
//user = new User("pms9", "Paul Smith", "none set", true, false, false);
// out.write(user.toString() + "\n\n");
out.write("#########\n#Test 04#\n#########\n");
out.write("Instantise User with over-loaded Constructor.\nParameters passed:\n"+
"\tuserID: pms9\n"+
"\tname: Paul Smith\n"+
"\tpassword: none set\n"+
"\tadmin: true\n"+
"\ttop: true\n"+
"\tbottom: false\n\ntoString() returns:\n");
user = new User("pms9", "Paul Smith", "none set", true, true, false);
out.write(user.toString() + "\n\n");
out.write("#########\n#Test 05#\n#########\n");
out.write("Instantise User with over-loaded Constructor.\nParameters passed:\n"+
"\tuserID: pms9\n"+
"\tname: Paul Smith\n"+
"\tpassword: none set\n"+
"\tadmin: true\n"+
"\ttop: false\n"+
"\tbottom: true\n\ntoString() returns:\n");
user = new User("pms9", "Paul Smith", "none set", true, false, true);
out.write(user.toString() + "\n\n");
out.write("#########\n#Test 06#\n#########\n");
out.write("Instantise User with over-loaded Constructor.\nParameters passed:\n"+
"\tuserID: pms9\n"+
"\tname: Paul Smith\n"+
"\tpassword: none set\n"+
"\tadmin: false\n"+
"\ttop: true\n"+
"\tbottom: false\n\ntoString() returns:\n");
user = new User("pms9", "Paul Smith", "none set", false, true, false);
out.write(user.toString() + "\n\n");
out.write("#########\n#Test 07#\n#########\n");
out.write("Instantise User with over-loaded Constructor.\nParameters passed:\n"+
"\tuserID: pms9\n"+
"\tname: Paul Smith\n"+
"\tpassword: none set\n"+
"\tadmin: false\n"+
"\ttop: false\n"+
"\tbottom: true\n\ntoString() returns:\n");
user = new User("pms9", "Paul Smith", "none set", false, false, true);
out.write(user.toString() + "\n\n");
out.write("#########\n#Test 08#\n#########\n");
out.write("Instantise User with over-loaded Constructor.\nParameters passed:\n"+
"\tuserID: pms9\n"+
"\tname: Paul Smith\n"+
"\tpassword: none set\n"+
"\tadmin: false\n"+
"\ttop: true\n"+
"\tbottom: true\n\ntoString() returns:\n");
user = new User("pms9", "Paul Smith", "none set", false, true, true);
out.write(user.toString() + "\n\n");
out.write("#########\n#Test 09#\n#########\n");
out.write("Instantise User, specifing the userID to:\"pms9\", and call getUserID().\n");
user = new User("pms9", "", "", false, false, false);
out.write(user.getUserID() + "\n\n");
out.write("#########\n#Test 10#\n#########\n");
out.write("Instantise User, specifing the userID to:\"pms8\", calling setUserID(\"pms9\"), and call getUserID().\n");
user = new User("pms8", "", "", false, false, false);
out.write(user.getUserID() + "\nSetting to \"pms9\"\n");
user.setUserID("pms9");
out.write(user.getUserID() + "\n\n");
out.write("#########\n#Test 11#\n#########\n");
out.write("Instantise User, specifing the userID to:\"pms9\", and call getUserID().\n");
out.write(user.getUserID() + "\n\n");
out.write("#########\n#Test 12#\n#########\n");
out.write("Instantise User, specifing the userID to:\"pms9\", and call getUserID().\n");
out.write(user.getUserID() + "\n\n");
out.write("#########\n#Test 13#\n#########\n");
out.write("Instantise User, specifing the userID to:\"pms9\", and call getUserID().\n");
out.write(user.getUserID() + "\n\n");
}
}
Page automatically generated on: 28/12/00 at: 7:58:14 PM.