public class DailyMovementsRecords extends javax.swing.JFrame {
Connection conn;
Statement stmt;
PreparedStatement pst;
public void reloaded() {
try {
stmt = CreateDB.getConnection().createStatement();
} catch (Exception excp) {
JOptionPane.showMessageDialog(null, "Error on database connection", "Statement error", JOptionPane.ERROR_MESSAGE);
}//try catch closed
try {
String sql = ("SELECT * FROM movements_data ORDER BY No");
int Numrow=0;
ResultSet result = stmt.executeQuery(sql);
while (result.next()) {
if (run==1){
int key =0;
DefaultTableModel dtm = (DefaultTableModel) tableRecords.getModel();
key = tableRecords.getRowCount()+1;
dtm.setRowCount(key);
}
tableRecords.setValueAt(result.getString(1).trim(), Numrow, 0);
tableRecords.setValueAt(result.getString(2).trim(), Numrow, 1);
tableRecords.setValueAt(result.getString(3).trim(), Numrow, 2);
tableRecords.setValueAt(result.getString(4).trim(), Numrow, 3);
tableRecords.setValueAt(result.getString(5).trim(), Numrow, 4);
Numrow++;
}//while closed
run =0;
} catch (SQLException sqlex) {
JOptionPane.showMessageDialog(null, "Error on retrieving values", "Error", JOptionPane.ERROR_MESSAGE);
}//try catch closed
}//reloaded() closed
I've been asked to apply white box and black box testing techniques on this part of code. Is it possible to do it, without having other classes?
Aucun commentaire:
Enregistrer un commentaire