Skip to content
This repository has been archived by the owner on Aug 4, 2020. It is now read-only.

Commit

Permalink
Merge branch 'group-tests' into rel-0.12.2
Browse files Browse the repository at this point in the history
  • Loading branch information
juwon committed Dec 4, 2014
2 parents ed929b0 + ee5e2ad commit d3fa5ce
Show file tree
Hide file tree
Showing 32 changed files with 127 additions and 121 deletions.
2 changes: 1 addition & 1 deletion rest-api-sdk/pom.xml
Expand Up @@ -89,7 +89,7 @@
<configuration>
<parallel>methods</parallel>
<threadCount>10</threadCount>
<excludedGroups>integration</excludedGroups>
<groups>unit</groups>
</configuration>
</plugin>
</plugins>
Expand Down
Expand Up @@ -43,7 +43,7 @@ public static ShippingAddress createShippingAddress() {
return address;
}

@Test
@Test(groups = "unit")
public void testConstruction() {
Address address = createAddress();
Assert.assertEquals(address.getCity(), CITY);
Expand All @@ -55,13 +55,13 @@ public void testConstruction() {
Assert.assertEquals(address.getState(), STATE);
}

@Test
@Test(groups = "unit")
public void testTOJSON() {
Address address = createAddress();
Assert.assertEquals(address.toJSON().length() == 0, false);
}

@Test
@Test(groups = "unit")
public void testTOString() {
Address address = createAddress();
Assert.assertEquals(address.toString().length() == 0, false);
Expand Down
Expand Up @@ -18,7 +18,7 @@ public static Amount createAmount(String total) {
return amount;
}

@Test
@Test(groups = "unit")
public void testConstruction() {
Amount amount = createAmount("1000.00");
Assert.assertEquals(amount.getTotal(), "1000.00");
Expand All @@ -27,7 +27,7 @@ public void testConstruction() {
DetailsTestCase.FEE);
}

@Test
@Test(groups = "unit")
public void testTOJSON() {
Amount amount = createAmount("12.25");
Assert.assertEquals(amount.toJSON().length() == 0, false);
Expand Down
Expand Up @@ -53,7 +53,7 @@ public static Authorization createAuthorization() {
return authorization;
}

@Test
@Test(groups = "unit")
public void testConstruction() {
Authorization authorization = createAuthorization();
Assert.assertEquals(authorization.getId(), ID);
Expand Down
Expand Up @@ -51,7 +51,7 @@ public static Capture createCapture() {
return capture;
}

@Test
@Test(groups = "unit")
public void testConstruction() {
Capture capture = createCapture();
Assert.assertEquals(capture.getId(), ID);
Expand All @@ -63,7 +63,7 @@ public void testConstruction() {
Assert.assertEquals(capture.getLinks().size(), 1);
}

@Test(groups = "integration", dependsOnMethods = { "testAuthorizationVoid" })
@Test(groups = "integration")
public void testGetCapture() throws PayPalRESTException {
logger.info("**** Get Capture ****");
Payment payment = getPaymentAgainstAuthorization();
Expand Down
Expand Up @@ -87,7 +87,7 @@ public static CreditCard createDummyCreditCard() {
return creditCard;
}

@Test
@Test(groups = "unit")
public void testConstruction() {
CreditCard creditCard = createDummyCreditCard();
Assert.assertEquals(creditCard.getCvv2(), CVV2);
Expand Down
Expand Up @@ -15,20 +15,20 @@ public static CreditCardToken createCreditCardToken() {
return creditCardToken;
}

@Test
@Test(groups = "unit")
public void testConstruction() {
CreditCardToken creditCardToken = createCreditCardToken();
Assert.assertEquals(creditCardToken.getCreditCardId(), "CARD-8PV12506MG6587946KEBHH4A");
Assert.assertEquals(creditCardToken.getPayerId(), "12345");
}

@Test
@Test(groups = "unit")
public void testTOJSON() {
CreditCardToken creditCardToken = createCreditCardToken();
Assert.assertEquals(creditCardToken.toJSON().length() == 0, false);
}

@Test
@Test(groups = "unit")
public void testTOString() {
CreditCardToken creditCardToken = createCreditCardToken();
Assert.assertEquals(creditCardToken.toString().length() == 0, false);
Expand Down
Expand Up @@ -22,7 +22,7 @@ public static Details createDetails() {
return amountDetails;
}

@Test
@Test(groups = "unit")
public void testConstruction() {
Details amountDetails = createDetails();
Assert.assertEquals(amountDetails.getFee(), FEE);
Expand All @@ -31,13 +31,13 @@ public void testConstruction() {
Assert.assertEquals(amountDetails.getTax(), TAX);
}

@Test
@Test(groups = "unit")
public void testTOJSON() {
Details amountDetails = createDetails();
Assert.assertEquals(amountDetails.toJSON().length() == 0, false);
}

@Test
@Test(groups = "unit")
public void testTOString() {
Details amountDetails = createDetails();
Assert.assertEquals(amountDetails.toString().length() == 0, false);
Expand Down
Expand Up @@ -29,22 +29,22 @@ public static EventList createEventList() {
return eventList;
}

@Test
@Test(groups = "unit")
public void testEventListConstruction() {
EventList eventListt = createEventList();
Assert.assertNotEquals(eventListt.getEvents(), null);
Assert.assertEquals(eventListt.getCount(), 2);
Assert.assertNotEquals(eventListt.getLinks(), null);
}

@Test
@Test(groups = "unit")
public void testTOJSON() {
EventList eventList = createEventList();
Assert.assertEquals(eventList.toJSON().length() == 0, false);
logger.info("EventListJSON = " + eventList.toJSON());
}

@Test
@Test(groups = "unit")
public void testTOString() {
EventList eventList = createEventList();
Assert.assertEquals(eventList.toString().length() == 0, false);
Expand Down
Expand Up @@ -44,7 +44,7 @@ public static Event createSaleEvent() {
return event;
}

@Test
@Test(groups = "unit")
public void testEventConstruction() {
Event event = createEvent();
Event saleEvent = createSaleEvent();
Expand All @@ -60,22 +60,22 @@ public void testEventConstruction() {
Assert.assertEquals(saleEvent.getSummary(), EVENT_SUMMARY);
}

@Test
@Test(groups = "unit")
public void testTOJSON() {
Event event = createEvent();
Assert.assertEquals(event.toJSON().length() == 0, false);
logger.info("EventJSON = " + event.toJSON());
}

@Test
@Test(groups = "unit")
public void testTOString() {
Event event = createEvent();
Assert.assertEquals(event.toString().length() == 0, false);
}



@Test
@Test(groups = "integration")
public void testEventList() throws PayPalRESTException {
logger.info("**** Create Event ****");
TokenHolder.accessToken = new OAuthTokenCredential(WebhooksInputData.CLIENT_ID, WebhooksInputData.CLIENT_SECRET).getAccessToken();
Expand All @@ -94,7 +94,7 @@ public void testEventList() throws PayPalRESTException {
Assert.assertNotNull(list.getEvents().get(0).getLinks(), "HATEOAS links related to this call is Not Null");
}

@Test
@Test(groups = "integration")
public void testEventResend() throws PayPalRESTException {
logger.info("**** Resend Event ****");
TokenHolder.accessToken = new OAuthTokenCredential(WebhooksInputData.CLIENT_ID, WebhooksInputData.CLIENT_SECRET).getAccessToken();
Expand All @@ -112,7 +112,7 @@ public void testEventResend() throws PayPalRESTException {
Assert.assertNotNull(event.getLinks(), "HATEOAS links related to this call is Not Null");
}

@Test
@Test(groups = "integration")
public void testEventGet() throws PayPalRESTException {
logger.info("**** Get Event ****");
TokenHolder.accessToken = new OAuthTokenCredential(WebhooksInputData.CLIENT_ID, WebhooksInputData.CLIENT_SECRET).getAccessToken();
Expand All @@ -133,6 +133,7 @@ public void testEventGet() throws PayPalRESTException {
* To create a New Notification event, use the stub below.
* When prompted for payerId, use the payerId obtained from executing approval URL in payment.create request
*/
@Test(groups = "integration")
public void createNotification() throws PayPalRESTException, IOException {
logger.info("**** Create Notification ****");
TokenHolder.accessToken = new OAuthTokenCredential(WebhooksInputData.CLIENT_ID, WebhooksInputData.CLIENT_SECRET).getAccessToken();
Expand All @@ -158,6 +159,7 @@ public void createNotification() throws PayPalRESTException, IOException {
/**
* Creates a Payment with AuthorizeIntent and PayPal as Sale method
*/
@Test(groups = "integration")
public Payment createPaymentWithAuthorizeIntent() {
Details details = new Details();
details.setShipping("10");
Expand Down
Expand Up @@ -40,30 +40,30 @@ public static List<EventType> createAllEventTypeList() {
return eventTypes;
}

@Test
@Test(groups = "unit")
public void testCreateAllEventTypeListConstruction() {
List<EventType> eventTypeList = createAllEventTypeList();
for(int i=0; i < eventTypeList.size(); i++) {
Assert.assertEquals(eventTypeList.get(i).getName(), WebhooksInputData.availableEvents[i][0]);
}
}
@Test

@Test(groups = "unit")
public void testCreateAuthEventTypeListConstruction() {
List<EventType> eventTypeList = createAuthEventTypeList();
Assert.assertEquals(eventTypeList.get(0).getName(), WebhooksInputData.availableEvents[1][0]);
Assert.assertEquals(eventTypeList.get(1).getName(), WebhooksInputData.availableEvents[2][0]);
}
@Test

@Test(groups = "unit")
public void testTOJSON() {
EventTypeList eventTypeList = new EventTypeList();
eventTypeList.setEventTypes(createAllEventTypeList());
Assert.assertEquals(eventTypeList.toJSON().length() == 0, false);
logger.info("EventTypeListJSON = " + eventTypeList.toJSON());
}
@Test

@Test(groups = "unit")
public void testTOString() {
EventTypeList eventTypeList = new EventTypeList();
eventTypeList.setEventTypes(createAllEventTypeList());
Expand Down
Expand Up @@ -20,21 +20,21 @@ public static EventType createEventType() {
return eventType;
}

@Test
@Test(groups = "unit")
public void testEventConstruction() {
EventType eventType = createEventType();
Assert.assertEquals(eventType.getName(), WebhooksInputData.availableEvents[0][0]);
Assert.assertEquals(eventType.getDescription(), WebhooksInputData.availableEvents[0][1]);
}

@Test
@Test(groups = "unit")
public void testTOJSON() {
EventType eventType = createEventType();
Assert.assertEquals(eventType.toJSON().length() == 0, false);
logger.info("EventTypeJSON = " + eventType.toJSON());
}
@Test

@Test(groups = "unit")
public void testTOString() {
EventType eventType = createEventType();
Assert.assertEquals(eventType.toString().length() == 0, false);
Expand Down
Expand Up @@ -18,7 +18,7 @@ public static FundingInstrument createFundingInstrument() {
return fundingInstrument;
}

@Test
@Test(groups = "unit")
public void testConstruction() {
FundingInstrument fundingInsturment = createFundingInstrument();
Assert.assertEquals(fundingInsturment.getCreditCardToken()
Expand All @@ -27,13 +27,13 @@ public void testConstruction() {
CreditCardTestCase.CVV2);
}

@Test
@Test(groups = "unit")
public void testTOJSON() {
FundingInstrument fundingInsturment = createFundingInstrument();
Assert.assertEquals(fundingInsturment.toJSON().length() == 0, false);
}

@Test
@Test(groups = "unit")
public void testTOString() {
FundingInstrument fundingInsturment = createFundingInstrument();
Assert.assertEquals(fundingInsturment.toString().length() == 0, false);
Expand Down
Expand Up @@ -19,21 +19,21 @@ public static ItemList createItemList() {
return itemList;
}

@Test
@Test(groups = "unit")
public void testConstruction() {
ItemList itemList = createItemList();
Assert.assertEquals(itemList.getShippingAddress().getRecipientName(),
ShippingAddressTestCase.RECIPIENTSNAME);
Assert.assertEquals(itemList.getItems().size(), 2);
}

@Test
@Test(groups = "unit")
public void testTOJSON() {
ItemList itemList = createItemList();
Assert.assertEquals(itemList.toJSON().length() == 0, false);
}

@Test
@Test(groups = "unit")
public void testTOString() {
ItemList itemList = createItemList();
Assert.assertEquals(itemList.toString().length() == 0, false);
Expand Down
Expand Up @@ -28,7 +28,7 @@ public static Item createItem() {
return item;
}

@Test
@Test(groups = "unit")
public void testConstruction() {
Item item = createItem();
Assert.assertEquals(item.getName(), NAME);
Expand All @@ -38,14 +38,14 @@ public void testConstruction() {
Assert.assertEquals(item.getQuantity(), QUANTITY);
Assert.assertEquals(item.getSku(), SKU);
}
@Test

@Test(groups = "unit")
public void testTOJSON() {
Item item = createItem();
Assert.assertEquals(item.toJSON().length() == 0, false);
}
@Test

@Test(groups = "unit")
public void testTOString() {
Item item = createItem();
Assert.assertEquals(item.toString().length() == 0, false);
Expand Down
Expand Up @@ -19,21 +19,21 @@ public static Links createLinks() {
return link;
}

@Test
@Test(groups = "unit")
public void testConstruction() {
Links link = LinksTestCase.createLinks();
Assert.assertEquals(link.getHref(), HREF);
Assert.assertEquals(link.getRel(), REL);
Assert.assertEquals(link.getMethod(), METHOD);
}

@Test
@Test(groups = "unit")
public void testTOJSON() {
Links link = LinksTestCase.createLinks();
Assert.assertEquals(link.toJSON().length() == 0, false);
}
@Test

@Test(groups = "unit")
public void testTOString() {
Links link = LinksTestCase.createLinks();
Assert.assertEquals(link.toString().length() == 0, false);
Expand Down

0 comments on commit d3fa5ce

Please sign in to comment.