// Path: src/main/java/org/springframework/social/salesforce/api/QueryResult.java
// public class QueryResult {
// 
//     private int totalSize;
// 
//     private boolean done;
// 
//     private String nextRecordsUrl;
// 
//     private List<ResultItem> records;
// 
// 
//     public QueryResult(int totalSize, boolean done) {
//         this.totalSize = totalSize;
//         this.done = done;
//     }
// 
// 
//     public int getTotalSize() {
//         return totalSize;
//     }
// 
//     public boolean isDone() {
//         return done;
//     }
// 
//     public List<ResultItem> getRecords() {
//         return records;
//     }
// 
//     public void setRecords(List<ResultItem> records) {
//         this.records = records;
//     }
// 
//     public String getNextRecordsUrl() {
//         return nextRecordsUrl;
//     }
// 
//     public void setNextRecordsUrl(String nextRecordsUrl) {
//         this.nextRecordsUrl = nextRecordsUrl;
//     }
// 
//     public String getNextRecordsToken() {
//         if (this.nextRecordsUrl != null) {
//             return this.nextRecordsUrl.substring(this.nextRecordsUrl.lastIndexOf('/') + 1, this.nextRecordsUrl.length());
//         }
//         return null;
//     }
// 
// }
// 
// Path: src/main/java/org/springframework/social/salesforce/api/ResultItem.java
// public class ResultItem implements Serializable {
// 
//     private String type;
// 
//     private String url;
// 
//     private Map attributes;
// 
// 
//     public ResultItem(String type, String url) {
//         this.type = type;
//         this.url = url;
//         this.attributes = new HashMap();
//     }
// 
// 
//     public String getType() {
//         return this.type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     public String getUrl() {
//         return this.url;
//     }
// 
//     public void setUrl(String url) {
//         this.url = url;
//     }
// 
//     public Map getAttributes() {
//         return attributes;
//     }
// 
//     public void setAttributes(Map attributes) {
//         this.attributes = attributes;
//     }
// 
// }


import org.junit.Test;
import org.springframework.http.HttpStatus;
import org.springframework.social.salesforce.api.QueryResult;
import org.springframework.social.salesforce.api.ResultItem;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.springframework.http.HttpMethod.GET;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
/**
 * Copyright (C) 2017 https://github.com/jottley/spring-social-salesforce
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.social.salesforce.api.impl;




/**
 * @author Umut Utkan
 * @author Jared Ottley
 */
public class QueryTemplateTest extends AbstractSalesforceTest {

    @Test
    public void simpleQuery() {
        mockServer.expect(requestTo("https://na7.salesforce.com/services/data/" + salesforce.apiOperations().getVersion() + "/query?q=SELECT+Id%2C+Name%2C+BillingCity+FROM+Account"))
                .andExpect(method(GET))
                .andRespond(withStatus(HttpStatus.OK).body(loadResource("query-simple.json")).headers(responseHeaders));
// Path: src/main/java/org/springframework/social/salesforce/api/QueryResult.java
// public class QueryResult {
// 
//     private int totalSize;
// 
//     private boolean done;
// 
//     private String nextRecordsUrl;
// 
//     private List<ResultItem> records;
// 
// 
//     public QueryResult(int totalSize, boolean done) {
//         this.totalSize = totalSize;
//         this.done = done;
//     }
// 
// 
//     public int getTotalSize() {
//         return totalSize;
//     }
// 
//     public boolean isDone() {
//         return done;
//     }
// 
//     public List<ResultItem> getRecords() {
//         return records;
//     }
// 
//     public void setRecords(List<ResultItem> records) {
//         this.records = records;
//     }
// 
//     public String getNextRecordsUrl() {
//         return nextRecordsUrl;
//     }
// 
//     public void setNextRecordsUrl(String nextRecordsUrl) {
//         this.nextRecordsUrl = nextRecordsUrl;
//     }
// 
//     public String getNextRecordsToken() {
//         if (this.nextRecordsUrl != null) {
//             return this.nextRecordsUrl.substring(this.nextRecordsUrl.lastIndexOf('/') + 1, this.nextRecordsUrl.length());
//         }
//         return null;
//     }
// 
// }
// 
// Path: src/main/java/org/springframework/social/salesforce/api/ResultItem.java
// public class ResultItem implements Serializable {
// 
//     private String type;
// 
//     private String url;
// 
//     private Map attributes;
// 
// 
//     public ResultItem(String type, String url) {
//         this.type = type;
//         this.url = url;
//         this.attributes = new HashMap();
//     }
// 
// 
//     public String getType() {
//         return this.type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     public String getUrl() {
//         return this.url;
//     }
// 
//     public void setUrl(String url) {
//         this.url = url;
//     }
// 
//     public Map getAttributes() {
//         return attributes;
//     }
// 
//     public void setAttributes(Map attributes) {
//         this.attributes = attributes;
//     }
// 
// }


// Path: src/test/java/org/springframework/social/salesforce/api/impl/QueryTemplateTest.java
import org.junit.Test;
import org.springframework.http.HttpStatus;
import org.springframework.social.salesforce.api.QueryResult;
import org.springframework.social.salesforce.api.ResultItem;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.springframework.http.HttpMethod.GET;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;

/**
 * Copyright (C) 2017 https://github.com/jottley/spring-social-salesforce
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.social.salesforce.api.impl;




/**
 * @author Umut Utkan
 * @author Jared Ottley
 */
public class QueryTemplateTest extends AbstractSalesforceTest {

    @Test
    public void simpleQuery() {
        mockServer.expect(requestTo("https://na7.salesforce.com/services/data/" + salesforce.apiOperations().getVersion() + "/query?q=SELECT+Id%2C+Name%2C+BillingCity+FROM+Account"))
                .andExpect(method(GET))
                .andRespond(withStatus(HttpStatus.OK).body(loadResource("query-simple.json")).headers(responseHeaders));
        QueryResult result = salesforce.queryOperations().query("SELECT Id, Name, BillingCity FROM Account");