// Path: src/main/java/com/cardinity/rest/RestResource.java
// public abstract class RestResource {
// 
//     // @formatter:off
//     public static final Gson GSON = new GsonBuilder()
//             .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
//             .registerTypeAdapter(Payment.class, new PaymentDeserializer())
//             .registerTypeAdapter(Card.class, new CardSerializer())
//             .registerTypeAdapter(Date.class, new UtcDateTypeAdapter())
//             .create();
//     // @formatter:on
// 
// 
//     public enum RequestMethod {
//         GET, PATCH, POST
//     }
// 
//     public enum Resource {
//         PAYMENTS, REFUNDS, SETTLEMENTS, VOIDS, CHARGEBACKS
//     }
// 
// }
// 
// Path: src/main/java/com/cardinity/rest/URLUtils.java
// public final class URLUtils {
// 
//     private final static String URL_SEPARATOR = "/";
// 
//     private URLUtils() {
// 
//     }
// 
//     public static String buildUrl() {
//         return buildCardinityUrl(null, null, null);
//     }
// 
//     public static String buildUrl(UUID paymentId) {
//         return buildCardinityUrl(paymentId, null, null);
//     }
// 
//     public static String buildUrl(UUID paymentId, Resource resource) {
//         return buildCardinityUrl(paymentId, resource, null);
//     }
// 
//     public static String buildUrl(UUID paymentId, Resource resource, UUID actionID) {
//         return buildCardinityUrl(paymentId, resource, actionID);
//     }
// 
//     private static String buildCardinityUrl(UUID paymentId, Resource action, UUID actionId) {
// 
//         StringBuilder url = new StringBuilder(Cardinity.API_BASE).append(URL_SEPARATOR).append(Cardinity.API_VERSION)
//                 .append(URL_SEPARATOR).append(Resource.PAYMENTS);
// 
//         if (paymentId != null) {
//             url.append(URL_SEPARATOR);
//             url.append(paymentId);
//             if (action != null) {
//                 url.append(URL_SEPARATOR);
//                 url.append(action);
//                 if (actionId != null) {
//                     url.append(URL_SEPARATOR);
//                     url.append(actionId);
//                 }
//             }
//         }
//         return url.toString().toLowerCase();
//     }
// 
//     public static String formatURL(String url, String query) {
//         if (query == null || query.isEmpty()) {
//             return url;
//         } else {
//             String separator = url.contains("?") ? "&" : "?";
//             return String.format("%s%s%s", url, separator, query);
//         }
//     }
// 
//     public static String buildQueryParam(String key, String value) throws UnsupportedEncodingException {
//         return String.format("%s=%s", URLEncoder.encode(key, Cardinity.ENCODING_CHARSET), URLEncoder.encode(value,
//                 Cardinity.ENCODING_CHARSET));
//     }
// }


import com.cardinity.rest.RestResource;
import com.cardinity.rest.URLUtils;
import org.junit.Before;
import org.junit.Test;
import java.util.UUID;
import static org.junit.Assert.*;
package com.cardinity.oauth;




public class CardinityOAuthProviderTest {

    private OAuthProvider oAuthProvider;

    @Before
    public void setUp() throws Exception {
        oAuthProvider = new CardinityOAuthProvider("test_key", "test_secret");
    }

    @Test
    public void testBuildAuthorizationHeader() throws Exception {

// Path: src/main/java/com/cardinity/rest/RestResource.java
// public abstract class RestResource {
// 
//     // @formatter:off
//     public static final Gson GSON = new GsonBuilder()
//             .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
//             .registerTypeAdapter(Payment.class, new PaymentDeserializer())
//             .registerTypeAdapter(Card.class, new CardSerializer())
//             .registerTypeAdapter(Date.class, new UtcDateTypeAdapter())
//             .create();
//     // @formatter:on
// 
// 
//     public enum RequestMethod {
//         GET, PATCH, POST
//     }
// 
//     public enum Resource {
//         PAYMENTS, REFUNDS, SETTLEMENTS, VOIDS, CHARGEBACKS
//     }
// 
// }
// 
// Path: src/main/java/com/cardinity/rest/URLUtils.java
// public final class URLUtils {
// 
//     private final static String URL_SEPARATOR = "/";
// 
//     private URLUtils() {
// 
//     }
// 
//     public static String buildUrl() {
//         return buildCardinityUrl(null, null, null);
//     }
// 
//     public static String buildUrl(UUID paymentId) {
//         return buildCardinityUrl(paymentId, null, null);
//     }
// 
//     public static String buildUrl(UUID paymentId, Resource resource) {
//         return buildCardinityUrl(paymentId, resource, null);
//     }
// 
//     public static String buildUrl(UUID paymentId, Resource resource, UUID actionID) {
//         return buildCardinityUrl(paymentId, resource, actionID);
//     }
// 
//     private static String buildCardinityUrl(UUID paymentId, Resource action, UUID actionId) {
// 
//         StringBuilder url = new StringBuilder(Cardinity.API_BASE).append(URL_SEPARATOR).append(Cardinity.API_VERSION)
//                 .append(URL_SEPARATOR).append(Resource.PAYMENTS);
// 
//         if (paymentId != null) {
//             url.append(URL_SEPARATOR);
//             url.append(paymentId);
//             if (action != null) {
//                 url.append(URL_SEPARATOR);
//                 url.append(action);
//                 if (actionId != null) {
//                     url.append(URL_SEPARATOR);
//                     url.append(actionId);
//                 }
//             }
//         }
//         return url.toString().toLowerCase();
//     }
// 
//     public static String formatURL(String url, String query) {
//         if (query == null || query.isEmpty()) {
//             return url;
//         } else {
//             String separator = url.contains("?") ? "&" : "?";
//             return String.format("%s%s%s", url, separator, query);
//         }
//     }
// 
//     public static String buildQueryParam(String key, String value) throws UnsupportedEncodingException {
//         return String.format("%s=%s", URLEncoder.encode(key, Cardinity.ENCODING_CHARSET), URLEncoder.encode(value,
//                 Cardinity.ENCODING_CHARSET));
//     }
// }


// Path: src/test/java/com/cardinity/oauth/CardinityOAuthProviderTest.java
import com.cardinity.rest.RestResource;
import com.cardinity.rest.URLUtils;
import org.junit.Before;
import org.junit.Test;
import java.util.UUID;
import static org.junit.Assert.*;

package com.cardinity.oauth;




public class CardinityOAuthProviderTest {

    private OAuthProvider oAuthProvider;

    @Before
    public void setUp() throws Exception {
        oAuthProvider = new CardinityOAuthProvider("test_key", "test_secret");
    }

    @Test
    public void testBuildAuthorizationHeader() throws Exception {

        String getPaymentUrl = URLUtils.buildUrl(UUID.fromString("dfca64ac-fee6-11e4-a322-1697f925ec7b"));