@Test public void vnocCreditReqErrorsWhenInvalidData() { CreditsResource.CreditRequestParams cReq = new CreditsResource.CreditRequestParams(); Response res = cRes.requestMoreCredits(cReq, null); assertEquals(400, res.getStatus()); cReq.contactId = "notnull"; cReq.amount = "-100"; res = cRes.requestMoreCredits(cReq, ACME_ID); assertEquals(400, res.getStatus()); cReq.amount = "125"; // not a multiple of 100 res = cRes.requestMoreCredits(cReq, ACME_ID); assertEquals(400, res.getStatus()); }
@Test public void vnocCreditReqEmailForGamLooksGood() { given(gamCtc.getPrimaryEmailContact()).willReturn("*****@*****.**"); given(custCtc.getPrimaryEmailContact()).willReturn("*****@*****.**"); given(customer.getCustomerId()).willReturn(ACME_ID); given(customer.getCustomerName()).willReturn("Acme Labs"); Email email = cRes.genEmailForGam(customer, gamCtc, custCtc, 100); assertNotNull(email.getSmtpServer()); assertEquals(email.getTo(), "*****@*****.**"); assertEquals("NEW LEAD for Acme Labs from [email protected]", email.getSubject()); }