You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/11/12 14:04:45 UTC

[GitHub] [camel-quarkus] aldettinger commented on a change in pull request #3291: Avoid using Camel Salesforce DTO types as the return type or method parameters in integration tests

aldettinger commented on a change in pull request #3291:
URL: https://github.com/apache/camel-quarkus/pull/3291#discussion_r748310681



##########
File path: integration-tests/salesforce/src/test/java/org/apache/camel/quarkus/component/salesforce/SalesforceTest.java
##########
@@ -133,73 +168,82 @@ void testGetVersions() {
 
     @Test
     void testGetRestResources() {
-        RestResources restResources = RestAssured.given()
+        RestAssured.given()
                 .get("/salesforce/resources")
                 .then()
                 .statusCode(200)
-                .extract()
-                .body()
-                .as(RestResources.class);
-        assertNotNull(restResources);
+                .body(matchesPattern("/services/data/.*/sobjects"));
     }
 
     @Test
     void testAccountWithBasicInfo() {
-        // create an object of type Account
-        String accountName = "Camel Quarkus Account Test: " + UUID.randomUUID().toString();
-        final String accountId = RestAssured.given()
-                .body(accountName)
-                .post("/salesforce/account")
-                .then()
-                .statusCode(200)
-                .extract()
-                .body()
-                .asString();
+        String accountId = null;
+        String accountName = "Camel Quarkus Account Test: " + UUID.randomUUID();
 
-        // get Account basic info
-        SObjectBasicInfo accountBasicInfo = RestAssured.given()
-                .get("/salesforce/basic-info/account")
-                .then()
-                .statusCode(200)
-                .extract()
-                .body()
-                .as(SObjectBasicInfo.class);
-        assertNotNull(accountBasicInfo);
-        List<RecentItem> recentItems = accountBasicInfo.getRecentItems();
-        assertNotNull(recentItems);
-        // make sure the created account is referenced
-        assertTrue(recentItems.stream().anyMatch(recentItem -> recentItem.getAttributes().getUrl().contains(accountId)));
-
-        // Get Account - querying Sobject by ID
-        RestAssured.get("/salesforce/account/" + accountId)
-                .then()
-                .statusCode(200)
-                .body(
-                        "Id", not(emptyString()),
-                        "AccountNumber", not(emptyString()));
+        try {
+            // create an object of type Account
+            accountId = RestAssured.given()
+                    .body(accountName)
+                    .post("/salesforce/account")
+                    .then()
+                    .statusCode(200)
+                    .extract()
+                    .body()
+                    .asString();
 
-        // delete the account
-        // Clean up
-        RestAssured.delete("/salesforce/account/" + accountId)
-                .then()
-                .statusCode(204);
+            // get Account basic info
+            SObjectBasicInfo accountBasicInfo = RestAssured.given()

Review comment:
       Maybe I've missread but I thought it returned JSonObject now ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org