@Test public void updatePaymentTest() throws Exception { Payment paymentLocalInstance = new Payment("updateTest", new Date(), "updateTest", 12.222); assertEquals(false, paymentLocalInstance.isOpen()); paymentDatabase.addPaymentAndReturnItsId(paymentLocalInstance); long id = paymentDatabase.getPaymentIdByPosition(paymentDatabase.getPaymentsNumber() - 1); paymentLocalInstance.setName("update test after update"); paymentLocalInstance.setIsOpen(true); paymentDatabase.updatePayment(paymentLocalInstance, id); Payment payment = paymentDatabase.getPaymentById(id); assertEquals(paymentLocalInstance.getName(), payment.getName()); assertEquals(paymentLocalInstance.isOpen(), payment.isOpen()); }
public void updatePaymentInDatabase(Payment payment, int position) { paymentDatabase.updatePayment(payment, getItemId(position)); }