1 5 package net.sourceforge.jwebunit; 6 7 import java.util.ArrayList ; 8 9 14 public class ExpectedTable { 15 16 private ArrayList expectedRows = new ArrayList (); 17 18 22 public ExpectedTable() { 23 } 24 25 33 public ExpectedTable(Object [][] expectedValues) { 34 appendRows(expectedValues); 35 } 36 37 45 public void appendRows(Object [][] newExpectedValues) { 46 for (int i = 0; i < newExpectedValues.length; i++) { 47 expectedRows.add(new ExpectedRow(newExpectedValues[i])); 48 } 49 } 50 51 56 public void appendRows(ExpectedTable exptectedTable) { 57 expectedRows.addAll(exptectedTable.getExpectedRows()); 58 } 59 60 65 public void appendRow(ExpectedRow row) { 66 expectedRows.add(row); 67 } 68 69 77 public String [][] getExpectedStrings() { 78 String [][] asStringArray = new String [expectedRows.size()][]; 79 for (int i = 0; i < expectedRows.size(); i++) { 80 ExpectedRow expectedRow = (ExpectedRow)expectedRows.get(i); 81 asStringArray[i] = expectedRow.getExpandedColumns(); 82 } 83 return asStringArray; 84 } 85 86 90 public String toString() { 91 StringBuffer asString = new StringBuffer (); 92 String [][] asStringArray = getExpectedStrings(); 93 for (int i = 0; i < asStringArray.length; i++) { 94 asString.append("{"); 95 Object [] expectedRow = asStringArray[i]; 96 for (int j = 0; j < expectedRow.length; j++) { 97 asString.append("{"); 98 String column = (String ) expectedRow[j]; 99 asString.append(column); 100 asString.append("}"); 101 } 102 asString.append("}"); 103 } 104 return asString.toString(); 105 } 106 107 ArrayList getExpectedRows() { 108 return expectedRows; 109 } 110 111 } 112 | Popular Tags |