public class StringValuesTable extends Object
ArrayResultSetFactory) to provide for easy
set up of unit test fixtures and assertion of outcomes with the same data
structures, without any need for external sources of test data.| Constructor and Description |
|---|
StringValuesTable(String name,
String[][] stringMatrix)
Creates a new
StringValuesTable with the given name,
columns and string matrix. |
StringValuesTable(String name,
String[] columnNames,
String[][] stringMatrix)
Creates a new
StringValuesTable with the given name,
columns and string matrix. |
| Modifier and Type | Method and Description |
|---|---|
String[] |
getColumn(int columnNumber)
Returns the contents of the given column.
|
String[] |
getColumn(String columnName)
Returns the contents of the given column.
|
String[] |
getColumnNames()
Returns the column names.
|
String |
getItem(int rowNumber,
int columnNumber)
Returns the item found in the string matrix at the given coordinate.
|
String |
getItem(int rowNumber,
String columnName)
Returns the item found in the string matrix at the given coordinate.
|
String |
getName()
Returns the table name.
|
int |
getNumberOfColumns()
Returns the number of columns found in the string matrix for this
StringValuesTable. |
int |
getNumberOfRows()
Returns the number of rows found in the string matrix for this
StringValuesTable. |
String[] |
getRow(int rowNumber)
Returns the elements of the given row.
|
String[][] |
getStringMatrix()
Returns the tabular data for this
StringValuesTable. |
boolean |
isValidColumnName(String columnName)
Returns
true if the given column name is valid for this
StringValuesTable; returns false
otherwise. |
boolean |
isValidColumnNumber(int columnNumber)
Returns
true if the given column number is valid for this
StringValuesTable; returns false
otherwise. |
boolean |
isValidRowNumber(int row)
Returns
true if the given row number is valid for this
StringValuesTable; returns false
otherwise. |
static String[] |
verifyColumnNames(String[] columnNames,
String[][] stringMatrix)
Returns the given array if it is found to indeed be valid according to
the published contract.
|
static String[][] |
verifyStringMatrix(String[][] stringMatrix)
Returns the given matrix if it is found to indeed be valid according to
the published contract.
|
public StringValuesTable(String name, String[][] stringMatrix)
StringValuesTable with the given name,
columns and string matrix.name - the table name. This argument cannot be null
and must contain at least 1 non-blank character.stringMatrix - the string matrix. This argument cannot be null,
must not contain any null values, and each array in the matrix
must contain the same number of elements as the first (stringMatrix[0].length == stringMatrix[n].length
for any given valid row number, n). Further,
this matrix must, at a minimum represent 1 row
and 1 column of items (stringMatrix.length >= 1,
and stringMatrix[0].length >= 1).public StringValuesTable(String name, String[] columnNames, String[][] stringMatrix)
StringValuesTable with the given name,
columns and string matrix.name - the table name. This argument cannot be null
and must contain at least 1 non-blank character.columnNames - the names for the columns in this
StringValuesTable. This argument may be null if no column names
are desired, but if a non-null array reference
is given, the array cannot contain any null nor
duplicate elements, and must have the same number of elements
as there are columns in the given string matrix (stringMatrix[n]
for any given valid row number, n).stringMatrix - the string matrix. This argument cannot be null,
must not contain any null values, and each array in the matrix
must contain the same number of elements as the first (stringMatrix[0].length == stringMatrix[n].length
for any given valid row number, n). Further,
this matrix must, at a minimum represent 1 row
and 1 column of items (stringMatrix.length >= 1,
and stringMatrix[0].length >= 1).public String[] getColumn(String columnName)
columnName - the name of the desired column. This argument cannot be
null and must be a valid column for this
StringValuesTable.public String[] getColumn(int columnNumber)
columnNumber - the index of the desired column (1-based).
This argument must be a valid column index for this
StringValuesTable.public String[] getColumnNames()
public String getItem(int rowNumber, String columnName)
rowNumber - the number of the desired row (1-based). This
argument must be a valid row number for this
StringValuesTable.columnName - the name of the desired column. This argument cannot be
null and must be a valid column for this
StringValuesTable.public String getItem(int rowNumber, int columnNumber)
rowNumber - the number of the desired row (1-based). This
argument must be a valid row number for this
StringValuesTable.columnNumber - the index of the desired column (1-based).
This argument must be a valid column index for this
StringValuesTable.public String getName()
public int getNumberOfColumns()
StringValuesTable.StringValuesTable.public int getNumberOfRows()
StringValuesTable.StringValuesTable.public String[] getRow(int rowNumber)
rowNumber - the number of the desired row (1-based). This
argument must be a valid row number for this
StringValuesTable.public boolean isValidColumnName(String columnName)
true if the given column name is valid for this
StringValuesTable; returns false
otherwise.columnName - the column name to verify.true if the given column name is valid for this
StringValuesTable.public boolean isValidColumnNumber(int columnNumber)
true if the given column number is valid for this
StringValuesTable; returns false
otherwise.columnNumber - the column number to verify.true if the given column number is valid for this
StringValuesTable.public boolean isValidRowNumber(int row)
true if the given row number is valid for this
StringValuesTable; returns false
otherwise.row - the row number to verify.true if the given index is valid for this
StringValuesTable.public String[][] getStringMatrix()
StringValuesTable.StringValuesTable.public static String[] verifyColumnNames(String[] columnNames, String[][] stringMatrix)
Copyright © 2003-2014. All Rights Reserved.