[Httpunit-commit] CVS: httpunit/doc/tutorial task1editor-validation.html,1.6,1.7
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2004-02-12 06:12:07
|
Update of /cvsroot/httpunit/httpunit/doc/tutorial In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9097/doc/tutorial Modified Files: task1editor-validation.html Log Message: Fix typos in tutorial (bugs #883293, 883301) Index: task1editor-validation.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/tutorial/task1editor-validation.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- task1editor-validation.html 23 May 2003 03:07:30 -0000 1.6 +++ task1editor-validation.html 12 Feb 2004 06:07:27 -0000 1.7 @@ -101,17 +101,18 @@ WebResponse response = client.getResponse( "http://localhost/PoolEditor" ); WebForm form = response.getFormWithID( "pool" ); - form.setParameter( "away1", "Detroit Lions" ); // (1) enter bad values into the form + form.setParameter( "away1", "Detroit Lions" ); // (1) enter bad values into the form form.setParameter( "home1", "Denver Broncos" ); form.setParameter( "home2", "Baltimore Ravens" ); form.setParameter( "tiebreaker", "3" ); - SubmitButton openButton = getSubmitButton( "save", "Open Pool" ); // (2) select the desired submit button - response = form.submit( saveButton ); // (3) submit the form + SubmitButton openButton = form.getSubmitButton( "save", "Open Pool" ); // (2) select the desired submit button + response = form.submit( saveButton ); // (3) submit the form - WebTable errorTable = response.getTableWithID( "errors" ); // (4) Look for the error table + WebTable errorTable = response.getTableWithID( "errors" ); // (4) Look for the error table assertNotNull( "No errors reported", errorTable ); - String[][] cells = errorTable.asText(); // (5) Convert non-empty cells to text + errorTable.purgeEmptyCells(); // (5) Remove any empty cells from the table + String[][] cells = errorTable.asText(); // (6) Convert non-empty cells to text assertEquals( "Number of error messages provided", 2, cells.length - 1 ); assertEquals( "Error message", "Tiebreaker is not a valid game", cells[1][0] ); assertEquals( "Error message", "Game 2 has no away team", cells[2][0] ); @@ -122,6 +123,7 @@ <li>We then select the "Open Pool" button to be included with the form submission.</li> <li>We want the response when we submit the form changes.</li> <li>We expect to find them in a table with "errors" as its ID.</li> +<li>We are not interested in any empty cells used for formatting.</li> <li>Since we want to examine the textual content of any non-empty cells in the table, we ask that the table be converted to a two-dimensional string array. In this case, there should only be one non-blank cell in each row.</li></ol></p> @@ -177,7 +179,7 @@ assertNull( "Could still update the pool", form.getSubmitButton( "save" ) ); // (3) look for the buttons try { - request = form.getRequest(); + WebRequest request = form.getRequest(); request.setParameter( "home3", "Philadelphia Eagles" ); // (4) try to change an entry fail( "Could still edit the pool" ); } catch (IllegalRequestParameterException e) {} |