This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 850ee421e2a264456da7c2bc3c7f4d6fde66ca60 Author: Guillaume Nodet <[email protected]> AuthorDate: Mon Jun 22 16:43:15 2020 +0200 [CAMEL-11807] Upgrade camel-braintree to junit5 --- components/camel-braintree/pom.xml | 2 +- .../braintree/AbstractBraintreeTestSupport.java | 11 +-- .../braintree/AddOnGatewayIntegrationTest.java | 10 +- .../braintree/AddressGatewayIntegrationTest.java | 35 +++---- .../braintree/BraintreeComponentTest.java | 6 +- .../braintree/BraintreeConfigurationTest.java | 6 +- .../ClientTokenGatewayIntegrationTest.java | 4 +- ...editCardVerificationGatewayIntegrationTest.java | 14 +-- .../braintree/CustomerGatewayIntegrationTest.java | 10 +- .../braintree/DiscountGatewayIntegrationTest.java | 10 +- .../braintree/DisputeGatewayIntegrationTest.java | 51 +++++----- .../DocumentUploadGatewayIntegrationTest.java | 10 +- .../MerchantAccountGatewayIntegrationTest.java | 19 ++-- .../PaymentMethodGatewayIntegrationTest.java | 35 +++---- .../PaymentMethodNonceGatewayIntegrationTest.java | 14 +-- .../braintree/PlanGatewayIntegrationTest.java | 10 +- .../braintree/ReportGatewayIntegrationTest.java | 11 ++- ...ttlementBatchSummaryGatewayIntegrationTest.java | 14 +-- .../SubscriptionGatewayIntegrationTest.java | 38 ++++---- .../TransactionGatewayIntegrationTest.java | 105 +++++++++++---------- .../WebhookNotificationGatewayIntegrationTest.java | 35 +++---- 21 files changed, 248 insertions(+), 202 deletions(-) diff --git a/components/camel-braintree/pom.xml b/components/camel-braintree/pom.xml index 630a21f..c302d0a 100644 --- a/components/camel-braintree/pom.xml +++ b/components/camel-braintree/pom.xml @@ -93,7 +93,7 @@ <!-- testing --> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-test</artifactId> + <artifactId>camel-test-junit5</artifactId> <scope>test</scope> </dependency> </dependencies> diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java index 3e72180..5f5b7d9 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AbstractBraintreeTestSupport.java @@ -31,14 +31,16 @@ import org.apache.camel.component.braintree.internal.BraintreeConstants; import org.apache.camel.component.braintree.internal.BraintreeLogHandler; import org.apache.camel.support.PropertyBindingSupport; import org.apache.camel.support.component.ApiMethod; -import org.apache.camel.test.junit4.CamelTestSupport; +import org.apache.camel.test.junit5.CamelTestSupport; import org.apache.camel.util.ObjectHelper; +import org.junit.jupiter.api.TestInstance; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Abstract base class for Braintree Integration tests generated by Camel API component maven plugin. */ +@TestInstance(TestInstance.Lifecycle.PER_METHOD) public class AbstractBraintreeTestSupport extends CamelTestSupport { private static final Logger LOG = LoggerFactory.getLogger(AbstractBraintreeTestSupport.class); @@ -140,13 +142,6 @@ public class AbstractBraintreeTestSupport extends CamelTestSupport { return AuthenticationType.PUBLIC_PRIVATE_KEYS; } - @Override - public boolean isCreateCamelContextPerClass() { - - // only create the context once for this class - return false; - } - @SuppressWarnings("unchecked") protected <T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers) throws CamelExecutionException { return (T)template().requestBodyAndHeaders(endpointUri, body, headers); diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AddOnGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AddOnGatewayIntegrationTest.java index d91fc5c..c64ce44 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AddOnGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AddOnGatewayIntegrationTest.java @@ -21,22 +21,24 @@ import java.util.List; import com.braintreegateway.AddOn; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.AddOnGatewayApiMethod; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class AddOnGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final Logger LOG = LoggerFactory.getLogger(AddOnGatewayIntegrationTest.class); private static final String PATH_PREFIX = getApiNameAsString(AddOnGatewayApiMethod.class); - @Ignore + @Disabled @Test public void testAll() throws Exception { final List<AddOn> result = requestBody("direct://ALL", null, List.class); - assertNotNull("all result", result); + assertNotNull(result, "all result"); LOG.debug("all: " + result); } diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AddressGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AddressGatewayIntegrationTest.java index 2d54a86..bfd01e8 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AddressGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/AddressGatewayIntegrationTest.java @@ -29,11 +29,14 @@ import com.braintreegateway.Result; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.AddressGatewayApiMethod; import org.apache.camel.component.braintree.internal.BraintreeApiCollection; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class AddressGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final Logger LOG = LoggerFactory.getLogger(AddressGatewayIntegrationTest.class); private static final String PATH_PREFIX = BraintreeApiCollection.getCollection().getApiName(AddressGatewayApiMethod.class).getName(); @@ -68,7 +71,7 @@ public class AddressGatewayIntegrationTest extends AbstractBraintreeTestSupport } @Override - @After + @AfterEach public void tearDown() throws Exception { if (this.gateway != null && customer != null) { for (String id : this.addressIds) { @@ -99,7 +102,7 @@ public class AddressGatewayIntegrationTest extends AbstractBraintreeTestSupport .locality("Forest Hill") ); - assertNotNull("create", result); + assertNotNull(result, "create"); assertTrue(result.isSuccess()); LOG.info("Address created - customer={}, id={}", this.customer.getId(), result.getTarget().getId()); @@ -113,8 +116,8 @@ public class AddressGatewayIntegrationTest extends AbstractBraintreeTestSupport @Test public void testCreate() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); - assertNotNull("Customer can't be null", this.customer); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); + assertNotNull(this.customer, "Customer can't be null"); final Result<Address> address = requestBodyAndHeaders( "direct://CREATE", @@ -129,7 +132,7 @@ public class AddressGatewayIntegrationTest extends AbstractBraintreeTestSupport Result.class ); - assertNotNull("create", address); + assertNotNull(address, "create"); assertTrue(address.isSuccess()); LOG.info("Address created - customer={}, id={}", customer.getId(), address.getTarget().getId()); @@ -138,8 +141,8 @@ public class AddressGatewayIntegrationTest extends AbstractBraintreeTestSupport @Test public void testDelete() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); - assertNotNull("Customer can't be null", this.customer); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); + assertNotNull(this.customer, "Customer can't be null"); final Address address = createAddress(); final Result<Address> result = requestBodyAndHeaders( @@ -152,7 +155,7 @@ public class AddressGatewayIntegrationTest extends AbstractBraintreeTestSupport Result.class ); - assertNotNull("delete", address); + assertNotNull(address, "delete"); assertTrue(result.isSuccess()); LOG.info("Address deleted - customer={}, id={}", customer.getId(), address.getId()); @@ -160,8 +163,8 @@ public class AddressGatewayIntegrationTest extends AbstractBraintreeTestSupport @Test public void testFind() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); - assertNotNull("Customer can't be null", this.customer); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); + assertNotNull(this.customer, "Customer can't be null"); final Address addressRef = createAddress(); this.addressIds.add(addressRef.getId()); @@ -175,14 +178,14 @@ public class AddressGatewayIntegrationTest extends AbstractBraintreeTestSupport Address.class ); - assertNotNull("find", address); + assertNotNull(address, "find"); LOG.info("Address found - customer={}, id={}", customer.getId(), address.getId()); } @Test public void testUpdate() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); - assertNotNull("Customer can't be null", this.customer); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); + assertNotNull(this.customer, "Customer can't be null"); final Address addressRef = createAddress(); this.addressIds.add(addressRef.getId()); @@ -199,7 +202,7 @@ public class AddressGatewayIntegrationTest extends AbstractBraintreeTestSupport .build(), Result.class); - assertNotNull("update", result); + assertNotNull(result, "update"); assertTrue(result.isSuccess()); LOG.info("Address updated - customer={}, id={}", customer.getId(), result.getTarget().getId()); diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/BraintreeComponentTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/BraintreeComponentTest.java index 4337f7b..1be24e9 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/BraintreeComponentTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/BraintreeComponentTest.java @@ -22,10 +22,10 @@ import java.util.logging.Logger; import com.braintreegateway.BraintreeGateway; import org.apache.camel.component.braintree.internal.BraintreeApiName; import org.apache.camel.component.braintree.internal.BraintreeLogHandler; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; public class BraintreeComponentTest { diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/BraintreeConfigurationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/BraintreeConfigurationTest.java index be463ae..ea0e65b 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/BraintreeConfigurationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/BraintreeConfigurationTest.java @@ -21,10 +21,10 @@ import java.util.logging.Logger; import com.braintreegateway.BraintreeGateway; import org.apache.camel.component.braintree.internal.BraintreeLogHandler; -import org.junit.Test; +import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; public class BraintreeConfigurationTest { diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/ClientTokenGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/ClientTokenGatewayIntegrationTest.java index 3526252..898634f 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/ClientTokenGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/ClientTokenGatewayIntegrationTest.java @@ -19,7 +19,9 @@ package org.apache.camel.component.braintree; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.ClientTokenGatewayApiMethod; import org.apache.camel.util.ObjectHelper; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertTrue; public class ClientTokenGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final String PATH_PREFIX = getApiNameAsString(ClientTokenGatewayApiMethod.class); diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/CreditCardVerificationGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/CreditCardVerificationGatewayIntegrationTest.java index 96ea282..21ba34d 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/CreditCardVerificationGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/CreditCardVerificationGatewayIntegrationTest.java @@ -21,35 +21,37 @@ import com.braintreegateway.ResourceCollection; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.BraintreeApiCollection; import org.apache.camel.component.braintree.internal.CreditCardVerificationGatewayApiMethod; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class CreditCardVerificationGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final Logger LOG = LoggerFactory.getLogger(CreditCardVerificationGatewayIntegrationTest.class); private static final String PATH_PREFIX = BraintreeApiCollection.getCollection().getApiName(CreditCardVerificationGatewayApiMethod.class).getName(); // TODO provide parameter values for find - @Ignore + @Disabled @Test public void testFind() throws Exception { // using String message body for single parameter "id" final CreditCardVerification result = requestBody("direct://FIND", null, CreditCardVerification.class); - assertNotNull("find result", result); + assertNotNull(result, "find result"); LOG.debug("find: " + result); } // TODO provide parameter values for search - @Ignore + @Disabled @Test public void testSearch() throws Exception { // using com.braintreegateway.CreditCardVerificationSearchRequest message body for single parameter "query" final ResourceCollection<CreditCardVerification> result = requestBody("direct://SEARCH", null, ResourceCollection.class); - assertNotNull("search result", result); + assertNotNull(result, "search result"); LOG.debug("search: " + result); } diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/CustomerGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/CustomerGatewayIntegrationTest.java index 9e81c1b..c4c4cb1 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/CustomerGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/CustomerGatewayIntegrationTest.java @@ -31,10 +31,18 @@ import com.braintreegateway.exceptions.NotFoundException; import org.apache.camel.CamelExecutionException; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.CustomerGatewayApiMethod; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + public class CustomerGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final String PATH_PREFIX = getApiNameAsString(CustomerGatewayApiMethod.class); diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/DiscountGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/DiscountGatewayIntegrationTest.java index ce80920..58cbe8c 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/DiscountGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/DiscountGatewayIntegrationTest.java @@ -22,22 +22,24 @@ import com.braintreegateway.Discount; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.BraintreeApiCollection; import org.apache.camel.component.braintree.internal.DiscountGatewayApiMethod; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class DiscountGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final Logger LOG = LoggerFactory.getLogger(DiscountGatewayIntegrationTest.class); private static final String PATH_PREFIX = BraintreeApiCollection.getCollection().getApiName(DiscountGatewayApiMethod.class).getName(); - @Ignore + @Disabled @Test public void testAll() throws Exception { final List<Discount> result = requestBody("direct://ALL", null, List.class); - assertNotNull("all result", result); + assertNotNull(result, "all result"); LOG.debug("all: " + result); } diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/DisputeGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/DisputeGatewayIntegrationTest.java index f957e19..4a66c74 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/DisputeGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/DisputeGatewayIntegrationTest.java @@ -39,10 +39,15 @@ import org.apache.camel.component.braintree.internal.BraintreeApiCollection; import org.apache.camel.component.braintree.internal.DisputeGatewayApiMethod; import org.apache.camel.component.braintree.internal.DocumentUploadGatewayApiMethod; import org.apache.camel.component.braintree.internal.TransactionGatewayApiMethod; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.apache.camel.test.junit5.TestSupport.assertListSize; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class DisputeGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final Logger LOG = LoggerFactory.getLogger(DisputeGatewayIntegrationTest.class); @@ -66,14 +71,14 @@ public class DisputeGatewayIntegrationTest extends AbstractBraintreeTestSupport "direct://ACCEPT", createdDispute.getId() ); - assertNotNull("accept result", result); - assertTrue("accept result success", result.isSuccess()); + assertNotNull(result, "accept result"); + assertTrue(result.isSuccess(), "accept result success"); final Dispute finalizedDispute = requestBody( "direct://FIND", createdDispute.getId() ); - assertNotNull("accepted dispute", finalizedDispute); + assertNotNull(finalizedDispute, "accepted dispute"); assertEquals(Dispute.Status.ACCEPTED, finalizedDispute.getStatus()); } @@ -93,8 +98,8 @@ public class DisputeGatewayIntegrationTest extends AbstractBraintreeTestSupport headers ); - assertNotNull("addFileEvidence result", result); - assertTrue("addFileEvidence result success", result.isSuccess()); + assertNotNull(result, "addFileEvidence result"); + assertTrue(result.isSuccess(), "addFileEvidence result success"); } @Test @@ -114,8 +119,8 @@ public class DisputeGatewayIntegrationTest extends AbstractBraintreeTestSupport headers ); - assertNotNull("addFileEvidence result", result); - assertTrue("addFileEvidence result success", result.isSuccess()); + assertNotNull(result, "addFileEvidence result"); + assertTrue(result.isSuccess(), "addFileEvidence result success"); } @Test @@ -134,8 +139,8 @@ public class DisputeGatewayIntegrationTest extends AbstractBraintreeTestSupport headers ); - assertNotNull("addTextEvidence result", result); - assertTrue("addTextEvidence result success", result.isSuccess()); + assertNotNull(result, "addTextEvidence result"); + assertTrue(result.isSuccess(), "addTextEvidence result success"); DisputeEvidence disputeEvidence = result.getTarget(); assertEquals(textEvidence, disputeEvidence.getComment()); @@ -159,8 +164,8 @@ public class DisputeGatewayIntegrationTest extends AbstractBraintreeTestSupport headers ); - assertNotNull("addTextEvidence result", result); - assertTrue("addTextEvidence result success", result.isSuccess()); + assertNotNull(result, "addTextEvidence result"); + assertTrue(result.isSuccess(), "addTextEvidence result success"); DisputeEvidence disputeEvidence = result.getTarget(); assertEquals(textEvidence, disputeEvidence.getComment()); @@ -175,14 +180,14 @@ public class DisputeGatewayIntegrationTest extends AbstractBraintreeTestSupport "direct://FINALIZE", createdDispute.getId() ); - assertNotNull("finalize result", result); - assertTrue("finalize result success", result.isSuccess()); + assertNotNull(result, "finalize result"); + assertTrue(result.isSuccess(), "finalize result success"); final Dispute finalizedDispute = requestBody( "direct://FIND", createdDispute.getId() ); - assertNotNull("finalized dispute", finalizedDispute); + assertNotNull(finalizedDispute, "finalized dispute"); assertEquals(Dispute.Status.DISPUTED, finalizedDispute.getStatus()); } @@ -195,7 +200,7 @@ public class DisputeGatewayIntegrationTest extends AbstractBraintreeTestSupport "direct://FIND", createdDispute.getId() ); - assertNotNull("found dispute", foundDispute); + assertNotNull(foundDispute, "found dispute"); assertEquals(Dispute.Status.OPEN, foundDispute.getStatus()); } @@ -216,8 +221,8 @@ public class DisputeGatewayIntegrationTest extends AbstractBraintreeTestSupport addTextEvidenceHeaders ); - assertNotNull("addTextEvidence result", addTextEvidenceResult); - assertTrue("addTextEvidence result success", addTextEvidenceResult.isSuccess()); + assertNotNull(addTextEvidenceResult, "addTextEvidence result"); + assertTrue(addTextEvidenceResult.isSuccess(), "addTextEvidence result success"); DisputeEvidence disputeEvidence = addTextEvidenceResult.getTarget(); assertEquals(textEvidence, disputeEvidence.getComment()); @@ -232,8 +237,8 @@ public class DisputeGatewayIntegrationTest extends AbstractBraintreeTestSupport removeTextEvidenceHeaders ); - assertNotNull("removeEvidence result", removeTextEvidenceResult); - assertTrue("removeEvidence result success", removeTextEvidenceResult.isSuccess()); + assertNotNull(removeTextEvidenceResult, "removeEvidence result"); + assertTrue(removeTextEvidenceResult.isSuccess(), "removeEvidence result success"); } @Test @@ -247,7 +252,7 @@ public class DisputeGatewayIntegrationTest extends AbstractBraintreeTestSupport query ); - assertNotNull("search result", result); + assertNotNull(result, "search result"); for (Dispute foundDispute : result) { assertEquals(createdDispute.getId(), foundDispute.getId()); } @@ -341,8 +346,8 @@ public class DisputeGatewayIntegrationTest extends AbstractBraintreeTestSupport "direct://CREATE", documentUploadRequest ); - assertNotNull("create result", documentUploadResult); - assertTrue("create result success", documentUploadResult.isSuccess()); + assertNotNull(documentUploadResult, "create result"); + assertTrue(documentUploadResult.isSuccess(), "create result success"); return documentUploadResult.getTarget(); } } diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/DocumentUploadGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/DocumentUploadGatewayIntegrationTest.java index 06c96c9..eb2b06d 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/DocumentUploadGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/DocumentUploadGatewayIntegrationTest.java @@ -24,10 +24,14 @@ import com.braintreegateway.Result; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.BraintreeApiCollection; import org.apache.camel.component.braintree.internal.DocumentUploadGatewayApiMethod; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class DocumentUploadGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final Logger LOG = LoggerFactory.getLogger(DocumentUploadGatewayIntegrationTest.class); @@ -48,8 +52,8 @@ public class DocumentUploadGatewayIntegrationTest extends AbstractBraintreeTestS documentUploadRequest ); - assertNotNull("create result", result); - assertTrue("create result success", result.isSuccess()); + assertNotNull(result, "create result"); + assertTrue(result.isSuccess(), "create result success"); DocumentUpload documentUpload = result.getTarget(); assertEquals(documentName, documentUpload.getName()); diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/MerchantAccountGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/MerchantAccountGatewayIntegrationTest.java index 61bc848..4e58cca 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/MerchantAccountGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/MerchantAccountGatewayIntegrationTest.java @@ -27,13 +27,16 @@ import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.BraintreeApiCollection; import org.apache.camel.component.braintree.internal.BraintreeConstants; import org.apache.camel.component.braintree.internal.MerchantAccountGatewayApiMethod; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; public class MerchantAccountGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final String PATH_PREFIX = BraintreeApiCollection.getCollection().getApiName(MerchantAccountGatewayApiMethod.class).getName(); - @Ignore + @Disabled @Test public void testCreate() throws Exception { final String merchantId = UUID.randomUUID().toString(); @@ -50,21 +53,21 @@ public class MerchantAccountGatewayIntegrationTest extends AbstractBraintreeTest Result.class ); - assertNotNull("create result", result); + assertNotNull(result, "create result"); assertTrue(result.isSuccess()); } - @Ignore + @Disabled @Test public void testFind() throws Exception { final Map<String, Object> headers = new HashMap<>(); headers.put(BraintreeConstants.PROPERTY_PREFIX + "id", System.getenv("CAMEL_BRAINTREE_MERCHANT_ACCOUNT_ID")); final MerchantAccount result = requestBodyAndHeaders("direct://FIND", null, headers, MerchantAccount.class); - assertNotNull("find result", result); + assertNotNull(result, "find result"); } - @Ignore + @Disabled @Test public void testUpdate() throws Exception { final Map<String, Object> headers = new HashMap<>(); @@ -80,7 +83,7 @@ public class MerchantAccountGatewayIntegrationTest extends AbstractBraintreeTest headers, Result.class); - assertNotNull("update result", result); + assertNotNull(result, "update result"); assertTrue(result.isSuccess()); } diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/PaymentMethodGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/PaymentMethodGatewayIntegrationTest.java index ee8012b..53a1211 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/PaymentMethodGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/PaymentMethodGatewayIntegrationTest.java @@ -28,11 +28,14 @@ import com.braintreegateway.PaymentMethodRequest; import com.braintreegateway.Result; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.PaymentMethodGatewayApiMethod; -import org.junit.After; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class PaymentMethodGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final Logger LOG = LoggerFactory.getLogger(PaymentMethodGatewayIntegrationTest.class); @@ -67,7 +70,7 @@ public class PaymentMethodGatewayIntegrationTest extends AbstractBraintreeTestSu } @Override - @After + @AfterEach public void tearDown() throws Exception { if (this.gateway != null) { for (String token : this.paymentMethodsTokens) { @@ -94,7 +97,7 @@ public class PaymentMethodGatewayIntegrationTest extends AbstractBraintreeTestSu .customerId(this.customer.getId()) .paymentMethodNonce("fake-valid-payroll-nonce")); - assertNotNull("create result", result); + assertNotNull(result, "create result"); assertTrue(result.isSuccess()); LOG.info("PaymentMethod created - token={}", result.getTarget().getToken()); @@ -108,8 +111,8 @@ public class PaymentMethodGatewayIntegrationTest extends AbstractBraintreeTestSu @Test public void testCreate() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); - assertNotNull("Customer can't be null", this.customer); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); + assertNotNull(this.customer, "Customer can't be null"); final Result<PaymentMethod> result = requestBody("direct://CREATE", new PaymentMethodRequest() @@ -117,7 +120,7 @@ public class PaymentMethodGatewayIntegrationTest extends AbstractBraintreeTestSu .paymentMethodNonce("fake-valid-payroll-nonce"), Result.class); - assertNotNull("create result", result); + assertNotNull(result, "create result"); assertTrue(result.isSuccess()); LOG.info("PaymentMethod created - token={}", result.getTarget().getToken()); @@ -126,14 +129,14 @@ public class PaymentMethodGatewayIntegrationTest extends AbstractBraintreeTestSu @Test public void testDelete() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); - assertNotNull("Customer can't be null", this.customer); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); + assertNotNull(this.customer, "Customer can't be null"); final PaymentMethod paymentMethod = createPaymentMethod(); final Result<PaymentMethod> deleteResult = requestBody( "direct://DELETE", paymentMethod.getToken(), Result.class); - assertNotNull("create result", deleteResult); + assertNotNull(deleteResult, "create result"); assertTrue(deleteResult.isSuccess()); LOG.info("PaymentMethod deleted - token={}", paymentMethod.getToken()); @@ -141,8 +144,8 @@ public class PaymentMethodGatewayIntegrationTest extends AbstractBraintreeTestSu @Test public void testFind() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); - assertNotNull("Customer can't be null", this.customer); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); + assertNotNull(this.customer, "Customer can't be null"); final PaymentMethod paymentMethod = createPaymentMethod(); this.paymentMethodsTokens.add(paymentMethod.getToken()); @@ -151,14 +154,14 @@ public class PaymentMethodGatewayIntegrationTest extends AbstractBraintreeTestSu "direct://FIND", paymentMethod.getToken(), PaymentMethod.class ); - assertNotNull("find result", method); + assertNotNull(method, "find result"); LOG.info("PaymentMethod found - token={}", method.getToken()); } @Test public void testUpdate() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); - assertNotNull("Customer can't be null", this.customer); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); + assertNotNull(this.customer, "Customer can't be null"); final PaymentMethod paymentMethod = createPaymentMethod(); this.paymentMethodsTokens.add(paymentMethod.getToken()); @@ -175,7 +178,7 @@ public class PaymentMethodGatewayIntegrationTest extends AbstractBraintreeTestSu .build(), Result.class); - assertNotNull("update result", result); + assertNotNull(result, "update result"); assertTrue(result.isSuccess()); LOG.info("PaymentMethod updated - token={}", result.getTarget().getToken()); diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/PaymentMethodNonceGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/PaymentMethodNonceGatewayIntegrationTest.java index 760a07c..2d00815 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/PaymentMethodNonceGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/PaymentMethodNonceGatewayIntegrationTest.java @@ -19,35 +19,37 @@ package org.apache.camel.component.braintree; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.BraintreeApiCollection; import org.apache.camel.component.braintree.internal.PaymentMethodNonceGatewayApiMethod; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class PaymentMethodNonceGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final Logger LOG = LoggerFactory.getLogger(PaymentMethodNonceGatewayIntegrationTest.class); private static final String PATH_PREFIX = BraintreeApiCollection.getCollection().getApiName(PaymentMethodNonceGatewayApiMethod.class).getName(); // TODO provide parameter values for create - @Ignore + @Disabled @Test public void testCreate() throws Exception { // using String message body for single parameter "paymentMethodToken" final com.braintreegateway.Result result = requestBody("direct://CREATE", null); - assertNotNull("create result", result); + assertNotNull(result, "create result"); LOG.debug("create: " + result); } // TODO provide parameter values for find - @Ignore + @Disabled @Test public void testFind() throws Exception { // using String message body for single parameter "paymentMethodNonce" final com.braintreegateway.PaymentMethodNonce result = requestBody("direct://FIND", null); - assertNotNull("find result", result); + assertNotNull(result, "find result"); LOG.debug("find: " + result); } diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/PlanGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/PlanGatewayIntegrationTest.java index 1dbc81b..76fb835 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/PlanGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/PlanGatewayIntegrationTest.java @@ -21,22 +21,24 @@ import java.util.List; import com.braintreegateway.Plan; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.PlanGatewayApiMethod; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class PlanGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final Logger LOG = LoggerFactory.getLogger(PlanGatewayIntegrationTest.class); private static final String PATH_PREFIX = getApiNameAsString(PlanGatewayApiMethod.class); - @Ignore + @Disabled @Test public void testAll() throws Exception { final List<Plan> result = requestBody("direct://ALL", null, List.class); - assertNotNull("all result", result); + assertNotNull(result, "all result"); LOG.debug("all: " + result); } diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/ReportGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/ReportGatewayIntegrationTest.java index 6de9cae..c9a3a56 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/ReportGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/ReportGatewayIntegrationTest.java @@ -26,10 +26,13 @@ import com.braintreegateway.TransactionLevelFeeReportRow; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.BraintreeApiCollection; import org.apache.camel.component.braintree.internal.ReportGatewayApiMethod; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + /** * Test class for {@link com.braintreegateway.ReportGateway} APIs. */ @@ -56,10 +59,10 @@ public class ReportGatewayIntegrationTest extends AbstractBraintreeTestSupport { request ); - assertNotNull("transactionLevelFees result", result); - assertTrue("transactionLevelFees success", result.isSuccess()); + assertNotNull(result, "transactionLevelFees result"); + assertTrue(result.isSuccess(), "transactionLevelFees success"); List<TransactionLevelFeeReportRow> rows = result.getTarget().getRows(); - assertTrue("transactionLevelFeeRows found", rows.size() > 0); + assertTrue(rows.size() > 0, "transactionLevelFeeRows found"); LOG.debug("transactionLevelFees: " + result); } diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/SettlementBatchSummaryGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/SettlementBatchSummaryGatewayIntegrationTest.java index 333cc42..49965dd 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/SettlementBatchSummaryGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/SettlementBatchSummaryGatewayIntegrationTest.java @@ -22,29 +22,31 @@ import java.util.Map; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.BraintreeApiCollection; import org.apache.camel.component.braintree.internal.SettlementBatchSummaryGatewayApiMethod; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class SettlementBatchSummaryGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final Logger LOG = LoggerFactory.getLogger(SettlementBatchSummaryGatewayIntegrationTest.class); private static final String PATH_PREFIX = BraintreeApiCollection.getCollection().getApiName(SettlementBatchSummaryGatewayApiMethod.class).getName(); // TODO provide parameter values for generate - @Ignore + @Disabled @Test public void testGenerate() throws Exception { // using java.util.Calendar message body for single parameter "settlementDate" final com.braintreegateway.Result result = requestBody("direct://GENERATE", null); - assertNotNull("generate result", result); + assertNotNull(result, "generate result"); LOG.debug("generate: " + result); } // TODO provide parameter values for generate - @Ignore + @Disabled @Test public void testGenerateWithCustomFields() throws Exception { final Map<String, Object> headers = new HashMap<>(); @@ -55,7 +57,7 @@ public class SettlementBatchSummaryGatewayIntegrationTest extends AbstractBraint final com.braintreegateway.Result result = requestBodyAndHeaders("direct://GENERATE_1", null, headers); - assertNotNull("generate result", result); + assertNotNull(result, "generate result"); LOG.debug("generate: " + result); } diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/SubscriptionGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/SubscriptionGatewayIntegrationTest.java index 8acea5f..ecf1bdf 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/SubscriptionGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/SubscriptionGatewayIntegrationTest.java @@ -22,40 +22,42 @@ import java.util.Map; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.BraintreeApiCollection; import org.apache.camel.component.braintree.internal.SubscriptionGatewayApiMethod; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertNotNull; + public class SubscriptionGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final Logger LOG = LoggerFactory.getLogger(SubscriptionGatewayIntegrationTest.class); private static final String PATH_PREFIX = BraintreeApiCollection.getCollection().getApiName(SubscriptionGatewayApiMethod.class).getName(); // TODO provide parameter values for cancel - @Ignore + @Disabled @Test public void testCancel() throws Exception { // using String message body for single parameter "id" final com.braintreegateway.Result result = requestBody("direct://CANCEL", null); - assertNotNull("cancel result", result); + assertNotNull(result, "cancel result"); LOG.debug("cancel: " + result); } // TODO provide parameter values for create - @Ignore + @Disabled @Test public void testCreate() throws Exception { // using com.braintreegateway.SubscriptionRequest message body for single parameter "request" final com.braintreegateway.Result result = requestBody("direct://CREATE", null); - assertNotNull("create result", result); + assertNotNull(result, "create result"); LOG.debug("create: " + result); } // TODO provide parameter values for delete - @Ignore + @Disabled @Test public void testDelete() throws Exception { final Map<String, Object> headers = new HashMap<>(); @@ -66,34 +68,34 @@ public class SubscriptionGatewayIntegrationTest extends AbstractBraintreeTestSup final com.braintreegateway.Result result = requestBodyAndHeaders("direct://DELETE", null, headers); - assertNotNull("delete result", result); + assertNotNull(result, "delete result"); LOG.debug("delete: " + result); } // TODO provide parameter values for find - @Ignore + @Disabled @Test public void testFind() throws Exception { // using String message body for single parameter "id" final com.braintreegateway.Subscription result = requestBody("direct://FIND", null); - assertNotNull("find result", result); + assertNotNull(result, "find result"); LOG.debug("find: " + result); } // TODO provide parameter values for retryCharge - @Ignore + @Disabled @Test public void testRetryCharge() throws Exception { // using String message body for single parameter "subscriptionId" final com.braintreegateway.Result result = requestBody("direct://RETRYCHARGE", null); - assertNotNull("retryCharge result", result); + assertNotNull(result, "retryCharge result"); LOG.debug("retryCharge: " + result); } // TODO provide parameter values for retryCharge - @Ignore + @Disabled @Test public void testRetryChargeWithAmount() throws Exception { final Map<String, Object> headers = new HashMap<>(); @@ -104,23 +106,23 @@ public class SubscriptionGatewayIntegrationTest extends AbstractBraintreeTestSup final com.braintreegateway.Result result = requestBodyAndHeaders("direct://RETRYCHARGE_1", null, headers); - assertNotNull("retryCharge result", result); + assertNotNull(result, "retryCharge result"); LOG.debug("retryCharge: " + result); } // TODO provide parameter values for search - @Ignore + @Disabled @Test public void testSearch() throws Exception { // using com.braintreegateway.SubscriptionSearchRequest message body for single parameter "searchRequest" final com.braintreegateway.ResourceCollection result = requestBody("direct://SEARCH", null); - assertNotNull("search result", result); + assertNotNull(result, "search result"); LOG.debug("search: " + result); } // TODO provide parameter values for update - @Ignore + @Disabled @Test public void testUpdate() throws Exception { final Map<String, Object> headers = new HashMap<>(); @@ -131,7 +133,7 @@ public class SubscriptionGatewayIntegrationTest extends AbstractBraintreeTestSup final com.braintreegateway.Result result = requestBodyAndHeaders("direct://UPDATE", null, headers); - assertNotNull("update result", result); + assertNotNull(result, "update result"); LOG.debug("update: " + result); } diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java index 1b8aed5..74913e9 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/TransactionGatewayIntegrationTest.java @@ -31,12 +31,15 @@ import com.braintreegateway.TransactionRequest; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.BraintreeApiCollection; import org.apache.camel.component.braintree.internal.TransactionGatewayApiMethod; -import org.junit.After; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final Logger LOG = LoggerFactory.getLogger(TransactionGatewayIntegrationTest.class); @@ -60,7 +63,7 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp } @Override - @After + @AfterEach public void tearDown() throws Exception { if (this.gateway != null) { for (String token : this.transactionIds) { @@ -76,7 +79,7 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp @Test public void testSale() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); final Result<Transaction> result = requestBody( "direct://SALE", @@ -88,7 +91,7 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp .done(), Result.class); - assertNotNull("sale result", result); + assertNotNull(result, "sale result"); assertTrue(result.isSuccess()); LOG.info("Transaction done - id={}", result.getTarget().getId()); @@ -97,7 +100,7 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp @Test public void testCloneTransaction() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); final Result<Transaction> createResult = requestBody( "direct://SALE", @@ -109,7 +112,7 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp .done(), Result.class); - assertNotNull("sale result", createResult); + assertNotNull(createResult, "sale result"); assertTrue(createResult.isSuccess()); LOG.info("Transaction done - id={}", createResult.getTarget().getId()); @@ -128,7 +131,7 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp .build(), Result.class); - assertNotNull("clone result", cloneResult); + assertNotNull(cloneResult, "clone result"); assertTrue(cloneResult.isSuccess()); LOG.info("Clone Transaction done - clonedId={}, id={}", @@ -139,7 +142,7 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp @Test public void testFind() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); final Result<Transaction> createResult = requestBody( "direct://SALE", @@ -151,7 +154,7 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp .done(), Result.class); - assertNotNull("sale result", createResult); + assertNotNull(createResult, "sale result"); assertTrue(createResult.isSuccess()); LOG.info("Transaction done - id={}", createResult.getTarget().getId()); @@ -161,13 +164,13 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp // using String message body for single parameter "id" final Transaction result = requestBody("direct://FIND", createResult.getTarget().getId()); - assertNotNull("find result", result); + assertNotNull(result, "find result"); LOG.info("Transaction found - id={}", result.getId()); } @Test public void testSubmitForSettlementWithId() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); final Result<Transaction> createResult = requestBody( "direct://SALE", @@ -179,7 +182,7 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp .done(), Result.class); - assertNotNull("sale result", createResult); + assertNotNull(createResult, "sale result"); assertTrue(createResult.isSuccess()); LOG.info("Transaction done - id={}", createResult.getTarget().getId()); @@ -190,13 +193,13 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp createResult.getTarget().getId(), Result.class); - assertNotNull("Submit For Settlement result", result); + assertNotNull(result, "Submit For Settlement result"); LOG.debug("Transaction submitted for settlement - id={}", result.getTarget().getId()); } @Test public void testSubmitForSettlementWithIdAndAmount() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); final Result<Transaction> createResult = requestBody( "direct://SALE", @@ -208,7 +211,7 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp .done(), Result.class); - assertNotNull("sale result", createResult); + assertNotNull(createResult, "sale result"); assertTrue(createResult.isSuccess()); LOG.info("Transaction done - id={}", createResult.getTarget().getId()); @@ -223,13 +226,13 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp .build(), Result.class); - assertNotNull("Submit For Settlement result", result); + assertNotNull(result, "Submit For Settlement result"); LOG.debug("Transaction submitted for settlement - id={}", result.getTarget().getId()); } @Test public void testSubmitForSettlementWithRequest() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); final Result<Transaction> createResult = requestBody( "direct://SALE", @@ -241,7 +244,7 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp .done(), Result.class); - assertNotNull("sale result", createResult); + assertNotNull(createResult, "sale result"); assertTrue(createResult.isSuccess()); LOG.info("Transaction done - id={}", createResult.getTarget().getId()); @@ -257,13 +260,13 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp .build(), Result.class); - assertNotNull("Submit For Settlement result", result); + assertNotNull(result, "Submit For Settlement result"); LOG.debug("Transaction submitted for settlement - id={}", result.getTarget().getId()); } @Test public void testRefund() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); final Result<Transaction> createResult = requestBody( "direct://SALE", @@ -276,13 +279,13 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp Result.class ); - assertNotNull("sale result", createResult); + assertNotNull(createResult, "sale result"); assertTrue(createResult.isSuccess()); String createId = createResult.getTarget().getId(); final Result<Transaction> settleResult = this.gateway.testing().settle(createId); - assertNotNull("settle result", settleResult); + assertNotNull(settleResult, "settle result"); assertTrue(settleResult.isSuccess()); final Result<Transaction> result = requestBody( @@ -291,14 +294,14 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp Result.class ); - assertNotNull("Request Refund result", result); + assertNotNull(result, "Request Refund result"); assertTrue(result.isSuccess()); LOG.info(String.format("Refund id(%s) created for transaction id(%s)", result.getTarget().getId(), createId)); } @Test public void testRefundWithAmount() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); + assertNotNull(this.gateway, "BraintreeGateway can't be null"); final Result<Transaction> createResult = requestBody( "direct://SALE", @@ -306,18 +309,18 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp .amount(new BigDecimal("100.00")) .paymentMethodNonce("fake-valid-nonce") .options() - .submitForSettlement(true) + .submitForSettlement(true) .done(), Result.class ); - assertNotNull("sale result", createResult); + assertNotNull(createResult, "sale result"); assertTrue(createResult.isSuccess()); String createId = createResult.getTarget().getId(); final Result<Transaction> settleResult = this.gateway.testing().settle(createId); - assertNotNull("settle result", settleResult); + assertNotNull(settleResult, "settle result"); assertTrue(settleResult.isSuccess()); final Result<Transaction> result = requestBodyAndHeaders( @@ -330,14 +333,14 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp Result.class ); - assertNotNull("Request Refund result", result); + assertNotNull(result, "Request Refund result"); assertTrue(result.isSuccess()); LOG.info(String.format("Refund id(%s) created for transaction id(%s)", result.getTarget().getId(), createId)); } @Test - public void testRefundWithRequest() throws Exception { - assertNotNull("BraintreeGateway can't be null", this.gateway); + public void testRefundWithRequest() throws Exception { + assertNotNull(this.gateway, "BraintreeGateway can't be null"); final Result<Transaction> createResult = requestBody( "direct://SALE", @@ -345,18 +348,18 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp .amount(new BigDecimal("100.00")) .paymentMethodNonce("fake-valid-nonce") .options() - .submitForSettlement(true) + .submitForSettlement(true) .done(), Result.class ); - assertNotNull("sale result", createResult); + assertNotNull(createResult, "sale result"); assertTrue(createResult.isSuccess()); String createId = createResult.getTarget().getId(); final Result<Transaction> settleResult = this.gateway.testing().settle(createId); - assertNotNull("settle result", settleResult); + assertNotNull(settleResult, "settle result"); assertTrue(settleResult.isSuccess()); final Result<Transaction> result = requestBodyAndHeaders( @@ -365,12 +368,12 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp new BraintreeHeaderBuilder() .add("id", createId) .add("refundRequest", new TransactionRefundRequest() - .amount(new BigDecimal("100.00"))) + .amount(new BigDecimal("100.00"))) .build(), Result.class ); - assertNotNull("Request Refund result", result); + assertNotNull(result, "Request Refund result"); assertTrue(result.isSuccess()); LOG.info(String.format("Refund id(%s) created for transaction id(%s)", result.getTarget().getId(), createId)); } @@ -380,62 +383,62 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp // ************************************************************************* // TODO provide parameter values for cancelRelease - @Ignore + @Disabled @Test public void testCancelRelease() throws Exception { // using String message body for single parameter "id" final com.braintreegateway.Result result = requestBody("direct://CANCELRELEASE", null); - assertNotNull("cancelRelease result", result); + assertNotNull(result, "cancelRelease result"); LOG.debug("cancelRelease: " + result); } // TODO provide parameter values for credit - @Ignore + @Disabled @Test public void testCredit() throws Exception { // using com.braintreegateway.TransactionRequest message body for single parameter "request" final com.braintreegateway.Result result = requestBody("direct://CREDIT", null); - assertNotNull("credit result", result); + assertNotNull(result, "credit result"); LOG.debug("credit: " + result); } // TODO provide parameter values for holdInEscrow - @Ignore + @Disabled @Test public void testHoldInEscrow() throws Exception { // using String message body for single parameter "id" final com.braintreegateway.Result result = requestBody("direct://HOLDINESCROW", null); - assertNotNull("holdInEscrow result", result); + assertNotNull(result, "holdInEscrow result"); LOG.debug("holdInEscrow: " + result); } // TODO provide parameter values for releaseFromEscrow - @Ignore + @Disabled @Test public void testReleaseFromEscrow() throws Exception { // using String message body for single parameter "id" final com.braintreegateway.Result result = requestBody("direct://RELEASEFROMESCROW", null); - assertNotNull("releaseFromEscrow result", result); + assertNotNull(result, "releaseFromEscrow result"); LOG.debug("releaseFromEscrow: " + result); } // TODO provide parameter values for search - @Ignore + @Disabled @Test public void testSearch() throws Exception { // using com.braintreegateway.TransactionSearchRequest message body for single parameter "query" final com.braintreegateway.ResourceCollection result = requestBody("direct://SEARCH", null); - assertNotNull("search result", result); + assertNotNull(result, "search result"); LOG.debug("search: " + result); } // TODO provide parameter values for submitForPartialSettlement - @Ignore + @Disabled @Test public void testSubmitForPartialSettlement() throws Exception { final Map<String, Object> headers = new HashMap<>(); @@ -446,18 +449,18 @@ public class TransactionGatewayIntegrationTest extends AbstractBraintreeTestSupp final com.braintreegateway.Result result = requestBodyAndHeaders("direct://SUBMITFORPARTIALSETTLEMENT", null, headers); - assertNotNull("submitForPartialSettlement result", result); + assertNotNull(result, "submitForPartialSettlement result"); LOG.debug("submitForPartialSettlement: " + result); } // TODO provide parameter values for voidTransaction - @Ignore + @Disabled @Test public void testVoidTransaction() throws Exception { // using String message body for single parameter "id" final com.braintreegateway.Result result = requestBody("direct://VOIDTRANSACTION", null); - assertNotNull("voidTransaction result", result); + assertNotNull(result, "voidTransaction result"); LOG.debug("voidTransaction: " + result); } diff --git a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/WebhookNotificationGatewayIntegrationTest.java b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/WebhookNotificationGatewayIntegrationTest.java index d5c534b..977c43e 100644 --- a/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/WebhookNotificationGatewayIntegrationTest.java +++ b/components/camel-braintree/src/test/java/org/apache/camel/component/braintree/WebhookNotificationGatewayIntegrationTest.java @@ -28,16 +28,19 @@ import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.braintree.internal.BraintreeApiCollection; import org.apache.camel.component.braintree.internal.BraintreeConstants; import org.apache.camel.component.braintree.internal.WebhookNotificationGatewayApiMethod; -import org.junit.Assume; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assumptions.assumeTrue; public class WebhookNotificationGatewayIntegrationTest extends AbstractBraintreeTestSupport { private static final String PATH_PREFIX = BraintreeApiCollection.getCollection().getApiName(WebhookNotificationGatewayApiMethod.class).getName(); - @Before + @BeforeEach public void checkAuthenticationType() { - Assume.assumeTrue(checkAuthenticationType(AuthenticationType.PUBLIC_PRIVATE_KEYS)); + assumeTrue(checkAuthenticationType(AuthenticationType.PUBLIC_PRIVATE_KEYS)); } @Test @@ -52,7 +55,7 @@ public class WebhookNotificationGatewayIntegrationTest extends AbstractBraintree private void runParseSubscriptionTest(WebhookNotification.Kind kind) throws Exception { final WebhookNotification result = sendSampleNotification(kind, "my_id"); - assertNotNull("parse result", result); + assertNotNull(result, "parse result"); assertEquals(kind, result.getKind()); assertEquals("my_id", result.getSubscription().getId()); } @@ -65,7 +68,7 @@ public class WebhookNotificationGatewayIntegrationTest extends AbstractBraintree private void runParseMerchantAccountTest(WebhookNotification.Kind kind) throws Exception { final WebhookNotification result = sendSampleNotification(kind, "my_id"); - assertNotNull("parse result", result); + assertNotNull(result, "parse result"); assertEquals(kind, result.getKind()); assertEquals("my_id", result.getMerchantAccount().getId()); } @@ -79,7 +82,7 @@ public class WebhookNotificationGatewayIntegrationTest extends AbstractBraintree private void runParseTransactionTest(WebhookNotification.Kind kind) throws Exception { final WebhookNotification result = sendSampleNotification(kind, "my_id"); - assertNotNull("parse result", result); + assertNotNull(result, "parse result"); assertEquals(kind, result.getKind()); assertEquals("my_id", result.getTransaction().getId()); } @@ -92,7 +95,7 @@ public class WebhookNotificationGatewayIntegrationTest extends AbstractBraintree private void runParseDisbursementTest(WebhookNotification.Kind kind) throws Exception { final WebhookNotification result = sendSampleNotification(kind, "my_id"); - assertNotNull("parse result", result); + assertNotNull(result, "parse result"); assertEquals(kind, result.getKind()); assertEquals("my_id", result.getDisbursement().getId()); } @@ -106,7 +109,7 @@ public class WebhookNotificationGatewayIntegrationTest extends AbstractBraintree private void runParseDisputeTest(WebhookNotification.Kind kind) throws Exception { final WebhookNotification result = sendSampleNotification(kind, "my_id"); - assertNotNull("parse result", result); + assertNotNull(result, "parse result"); assertEquals(kind, result.getKind()); assertEquals("my_id", result.getDispute().getId()); } @@ -120,7 +123,7 @@ public class WebhookNotificationGatewayIntegrationTest extends AbstractBraintree private void runParsePartnerMerchantTest(WebhookNotification.Kind kind) throws Exception { final WebhookNotification result = sendSampleNotification(kind, "merchant_public_id"); - assertNotNull("parse result", result); + assertNotNull(result, "parse result"); assertEquals(kind, result.getKind()); assertEquals("abc123", result.getPartnerMerchant().getPartnerMerchantId()); } @@ -132,7 +135,7 @@ public class WebhookNotificationGatewayIntegrationTest extends AbstractBraintree "my_merchant_public_id" ); - assertNotNull("parse result", result); + assertNotNull(result, "parse result"); assertEquals(WebhookNotification.Kind.CONNECTED_MERCHANT_STATUS_TRANSITIONED, result.getKind()); ConnectedMerchantStatusTransitioned connectedMerchantStatusTransitioned = result.getConnectedMerchantStatusTransitioned(); @@ -148,7 +151,7 @@ public class WebhookNotificationGatewayIntegrationTest extends AbstractBraintree "my_merchant_public_id" ); - assertNotNull("parse result", result); + assertNotNull(result, "parse result"); assertEquals(WebhookNotification.Kind.CONNECTED_MERCHANT_PAYPAL_STATUS_CHANGED, result.getKind()); ConnectedMerchantPayPalStatusChanged connectedMerchantPayPalStatusChanged = result.getConnectedMerchantPayPalStatusChanged(); @@ -164,7 +167,7 @@ public class WebhookNotificationGatewayIntegrationTest extends AbstractBraintree private void runParsePAccountUpdaterTest(WebhookNotification.Kind kind) throws Exception { final WebhookNotification result = sendSampleNotification(kind, "my_id"); - assertNotNull("parse result", result); + assertNotNull(result, "parse result"); assertEquals(kind, result.getKind()); assertEquals("link-to-csv-report", result.getAccountUpdaterDailyReport().getReportUrl()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); @@ -180,7 +183,7 @@ public class WebhookNotificationGatewayIntegrationTest extends AbstractBraintree private void runParseIdealPaymentTest(WebhookNotification.Kind kind) throws Exception { final WebhookNotification result = sendSampleNotification(kind, "my_id"); - assertNotNull("parse result", result); + assertNotNull(result, "parse result"); assertEquals(kind, result.getKind()); assertEquals("my_id", result.getIdealPayment().getId()); } @@ -192,7 +195,7 @@ public class WebhookNotificationGatewayIntegrationTest extends AbstractBraintree private void runParsePaymentInstrumentTest(WebhookNotification.Kind kind) throws Exception { final WebhookNotification result = sendSampleNotification(kind, "my_id"); - assertNotNull("parse result", result); + assertNotNull(result, "parse result"); assertEquals(kind, result.getKind()); assertEquals("abc123z", result.getGrantedPaymentInstrumentUpdate().getToken()); }*/
