@Before public void setUp() { String cols[] = new String[2]; cols[0] = "A"; cols[1] = "B"; metadata = new CursorMetadata(cols); row = new Object[] {"1", "2"}; rs = MockResultSet.create( MockResultSet.cols("A", "B"), MockResultSet.data(MockResultSet.row(row))); }
private void writeObjectsToFile(File file) throws IOException, SQLException { FileOutputStream fileOut = new FileOutputStream(file); try { ObjectOutputStream objectOut = new ObjectOutputStream(fileOut); rs = MockResultSet.create( MockResultSet.cols("A", "B"), MockResultSet.data(MockResultSet.row(row))); try { objectOut.writeObject(metadata); rs.next(); metadata.writeRow(objectOut, new ResultSetWrapper(rs)); rs.next(); metadata.writeRow(objectOut, new ResultSetWrapper(rs)); } finally { objectOut.close(); } } finally { fileOut.close(); } }