/** Test of serviceGetAllJaminan method, of class JaminanService. */ @Test public void d_getAllJaminan() { System.out.println("4. serviceGetAllJaminan"); tabelModelJaminan.setData(instance.serviceGetAllJaminan()); try { Statement stt = (Statement) connection.createStatement(); ResultSet rs = stt.executeQuery(getAllJaminan); while (rs.next()) { j.setIdJaminan(rs.getString("id_jaminan")); j.setNmJaminan(rs.getString("nm_jaminan")); j.setKetJaminan(rs.getString("ket_jaminan")); list.add(j); } rs.close(); stt.close(); } catch (Throwable t) { // Sengaja dikosongin } for (int i = 0; i < list.size(); i++) { assertEquals(list.get(i).getIdJaminan(), tabelModelJaminan.getValueAt(i, 0)); assertEquals(list.get(i).getNmJaminan(), tabelModelJaminan.getValueAt(i, 1)); assertEquals(list.get(i).getKetJaminan(), tabelModelJaminan.getValueAt(i, 2)); } }
/** Test of serviceInsertJaminan method, of class JaminanService. */ @Test public void a_insertJaminan() { System.out.println("1. serviceInsertJaminan"); expIdJaminan = "JPK PNS"; expNmJaminan = "Jaminan PK Pegawai Negeri Sipil"; expKetJaminan = "Jaminan kesahatan untuk pegawai negeri sipil"; j.setIdJaminan(expIdJaminan); j.setNmJaminan(expNmJaminan); j.setKetJaminan(expKetJaminan); instance.serviceInsertJaminan(j); tabelModelJaminan.setData(instance.serviceGetAllJaminanById(expIdJaminan)); assertEquals(expIdJaminan, tabelModelJaminan.getValueAt(0, 0)); assertEquals(expNmJaminan, tabelModelJaminan.getValueAt(0, 1)); assertEquals(expKetJaminan, tabelModelJaminan.getValueAt(0, 2)); }