/** Comprueba fecha creditCard */ private boolean checkCreditcard(CreditCard input) { boolean result; int actMonth, actYear; Calendar act; result = true; act = Calendar.getInstance(); actMonth = act.get(Calendar.MONTH); actYear = act.get(Calendar.YEAR); if (input.getExpirationYear() == actYear) { if (input.getExpirationMonth() < actMonth) { result = false; } } else if (input.getExpirationYear() < actYear) { result = false; } return result; }
// ---------------------------------------------------- // POSITIVE TEST CASES // ---------------------------------------------------- // - A user who is not authenticated must be able to: // o Place an order to send a flower to a recipient. @Test public void testPlaceFlowerOrder() { FlowerOrder flowerOrder = flowerOrderService.create(10); flowerOrder.setAddress("aADSDADASDasdasd"); CreditCard creditCard = new CreditCard(); creditCard.setBrandName("adasdasdad"); creditCard.setCvvCode(122); creditCard.setExpirationMonth(1); creditCard.setExpirationYear(2020); creditCard.setHolderName("asdasdsad"); creditCard.setNumber("4929468422750785"); Customer recipient = new Customer(); recipient.setEmailAddress("*****@*****.**"); recipient.setName("adsadasdasdd"); recipient.setSurname("asdasdasdasawq"); recipient.setPhoneNumber("+34sadsad dadsad"); Date birthdate = new Date(); birthdate.setDate(4); birthdate.setMonth(4); birthdate.setYear(90); recipient.setBirthdate(birthdate); Customer sender = new Customer(); sender.setEmailAddress("*****@*****.**"); sender.setName("adsadasdasdd"); sender.setSurname("asdasdasdasawq"); sender.setPhoneNumber("+34sadsad dadsad"); Date birthdate2 = new Date(); birthdate2.setDate(4); birthdate2.setMonth(4); birthdate2.setYear(90); sender.setBirthdate(birthdate2); flowerOrder.setRecipient(recipient); flowerOrder.setSender(sender); flowerOrder.setCreditCard(creditCard); flowerOrderService.save(flowerOrder); }