/*
* Method test for getIndex
*/
public void testGetIndex() {
DataTruncation aDataTruncation;
int[] init1 = { -2147483648, 2147483647, 0, -2045829673, 1977156911,
478985827, 1687271915 };
boolean[] init2 = { false, true, false, false, true, true, true };
boolean[] init3 = { false, true, false, false, true, true, true };
int[] init4 = { -2147483648, 2147483647, 0, -631377748, 21025030,
1215194589, 1064137121 };
int[] init5 = { -2147483648, 2147483647, 0, -897998505, 997578180,
735015866, 264619424 };
int theReturn;
int[] theReturns = init1;
String[] theFinalStates1 = { "01004", "01004", "01004", "01004",
"01004", "01004", "01004" };
String state2 = "Data truncation";
String[] theFinalStates2 = { state2, state2, state2, state2, state2,
state2, state2 };
int[] theFinalStates3 = { 0, 0, 0, 0, 0, 0, 0 };
int[] theFinalStates4 = init1;
int[] theFinalStates5 = init4;
int[] theFinalStates6 = init5;
boolean[] theFinalStates7 = init2;
boolean[] theFinalStates8 = init3;
Exception[] theExceptions = { null, null, null, null, null, null, null };
int loopCount = 1;
for (int i = 0; i < loopCount; i++) {
try {
aDataTruncation = new DataTruncation(init1[i], init2[i],
init3[i], init4[i], init5[i]);
theReturn = aDataTruncation.getIndex();
if (theExceptions[i] != null) {
fail(i + "Exception missed");
}
assertEquals(i + "Return value mismatch", theReturn,
theReturns[i]);
assertEquals(i + " Final state mismatch", aDataTruncation
.getSQLState(), theFinalStates1[i]);
assertEquals(i + " Final state mismatch", aDataTruncation
.getMessage(), theFinalStates2[i]);
assertEquals(i + " Final state mismatch", aDataTruncation
.getErrorCode(), theFinalStates3[i]);
assertEquals(i + " Final state mismatch", aDataTruncation
.getIndex(), theFinalStates4[i]);
assertEquals(i + " Final state mismatch", aDataTruncation
.getDataSize(), theFinalStates5[i]);
assertEquals(i + " Final state mismatch", aDataTruncation
.getTransferSize(), theFinalStates6[i]);
assertEquals(i + " Final state mismatch", aDataTruncation
.getParameter(), theFinalStates7[i]);
assertEquals(i + " Final state mismatch", aDataTruncation
.getRead(), theFinalStates8[i]);
} catch (Exception e) {
if (theExceptions[i] == null) {
fail(i + "Unexpected exception");