From 68f147084156a773fa5da3a060e909e23148a728 Mon Sep 17 00:00:00 2001 From: Diogo Moreira Date: Tue, 12 Dec 2017 12:15:52 +0000 Subject: [PATCH] Update tests --- .../integration/client/UpholdClientTest.java | 10 ++--- .../restadapter/UpholdRestAdapterTest.java | 17 +++++++-- .../test/integration/model/CardTest.java | 20 +++++----- .../test/integration/model/ReserveTest.java | 20 +++++----- .../integration/model/TransactionTest.java | 30 +++++++-------- .../test/integration/model/UserTest.java | 38 +++++++++---------- .../service/AccountServiceTest.java | 4 +- .../service/OAuth2ServiceTest.java | 14 +++---- .../service/ReserveServiceTest.java | 8 ++-- .../service/TickerServiceTest.java | 4 +- .../service/UserCardServiceTest.java | 24 ++++++------ .../integration/service/UserServiceTest.java | 18 ++++----- 12 files changed, 108 insertions(+), 99 deletions(-) diff --git a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/client/UpholdClientTest.java b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/client/UpholdClientTest.java index f5fe2a6..b7838a1 100644 --- a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/client/UpholdClientTest.java +++ b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/client/UpholdClientTest.java @@ -75,7 +75,7 @@ public void completeAuthorizationShouldReturnUpholdClientExceptionStateMatchErro UpholdClient.initialize(new MockSharedPreferencesContext()); String responseString = "{ \"access_token\": \"foo\", \"description\": \"bar\", \"expires\": null }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -105,7 +105,7 @@ public void completeAuthorizationShouldReturnTheAuthenticationResponse() throws ByteArrayOutputStream bodyOutput = new ByteArrayOutputStream(); String responseString = "{ \"access_token\": \"foo\", \"token_type\": \"bar\", \"expires_in\": 1234, \"scope\": \"foobar\"}"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -160,7 +160,7 @@ public void getTickersShouldReturnTheListOfRates() throws Exception { "\"pair\": \"foo\"" + "}" + "]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -219,7 +219,7 @@ public void getTickersByCurrencyShouldReturnTheListOfRates() throws Exception { "\"pair\": \"foo\"" + "}" + "]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -338,7 +338,7 @@ public void getUserShouldReturnTheUser() throws Exception { "}" + "}" + "}"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override diff --git a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/client/restadapter/UpholdRestAdapterTest.java b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/client/restadapter/UpholdRestAdapterTest.java index 84a8949..f9ceb9b 100644 --- a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/client/restadapter/UpholdRestAdapterTest.java +++ b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/client/restadapter/UpholdRestAdapterTest.java @@ -6,18 +6,24 @@ import com.darylteo.rx.promises.java.Promise; import com.darylteo.rx.promises.java.functions.RepromiseFunction; import com.uphold.uphold_android_sdk.BuildConfig; +import com.uphold.uphold_android_sdk.client.UpholdClient; import com.uphold.uphold_android_sdk.client.errorhandling.UpholdRetrofitErrorHandling; import com.uphold.uphold_android_sdk.client.restadapter.UpholdRestAdapter; +import com.uphold.uphold_android_sdk.client.session.SessionManager; import com.uphold.uphold_android_sdk.model.Card; +import com.uphold.uphold_android_sdk.model.Token; import com.uphold.uphold_android_sdk.model.User; import com.uphold.uphold_android_sdk.test.util.Fixtures; import com.uphold.uphold_android_sdk.test.util.MockRestAdapter; +import com.uphold.uphold_android_sdk.test.util.MockSharedPreferencesContext; import junit.framework.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import java.util.HashMap; + import retrofit.RestAdapter; import retrofit.client.Header; import retrofit.client.Request; @@ -35,7 +41,7 @@ public void setAdapterShouldSetTheAdapter() { UpholdRestAdapter upholdRestAdapter = new UpholdRestAdapter(); RestAdapter adapter = new RestAdapter.Builder().setEndpoint(BuildConfig.API_SERVER_URL) .setErrorHandler(new UpholdRetrofitErrorHandling()) - .setRequestInterceptor(upholdRestAdapter.getUpholdRequestInterceptor("foobar")) + .setRequestInterceptor(upholdRestAdapter.getUpholdRequestInterceptor()) .build(); upholdRestAdapter.setAdapter(adapter); @@ -45,7 +51,10 @@ public void setAdapterShouldSetTheAdapter() { @Test public void upholdRestAdapterWithTokenShoulSetTheUpholdCustomHeadersWithAuthenticationHeader() throws Exception { - MockRestAdapter adapter = new MockRestAdapter<>("fuz", null, null); + MockRestAdapter adapter = new MockRestAdapter<>(null, null); + + UpholdClient.initialize(new MockSharedPreferencesContext(new HashMap())); + SessionManager.INSTANCE.setBearerToken(new Token("fuz")); adapter.request(new RepromiseFunction() { @Override @@ -67,7 +76,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void setUpholdRequestInterceptorWithEmptyTokenShouldSetTheUpholdCustomHeadersWithoutAuthenticationHeader() throws Exception { - MockRestAdapter adapter = new MockRestAdapter<>("", null, null); + MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -88,7 +97,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void setUpholdRequestInterceptorWithNullTokenShouldSetTheUpholdCustomHeadersWithoutAuthenticationHeader() throws Exception{ - MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override diff --git a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/CardTest.java b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/CardTest.java index 09f2112..e52c7fd 100644 --- a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/CardTest.java +++ b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/CardTest.java @@ -39,7 +39,7 @@ public class CardTest { @Test public void createAddressShouldReturnTheAddress() throws Exception { String responseString = "{ \"id\": \"foobar\", \"network\": \"foobiz\" }"; - MockRestAdapter
adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter
adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -143,7 +143,7 @@ public void createTransactionShouldReturnTheTransaction() throws Exception { "\"percentage\": \"2.75\"" + "}]" + "}"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -229,7 +229,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void createTransactionCardDepositShouldReturnTheTransactionCommitted() throws Exception { String responseString = "{ \"id\": \"foobar\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -255,7 +255,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void createTransactionDepositShouldReturnTheTransactionCommitted() throws Exception { String responseString = "{ \"id\": \"foobar\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -281,7 +281,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void createTransactionTransferShouldReturnTheTransactionCommitted() throws Exception { String responseString = "{ \"id\": \"foobar\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -400,7 +400,7 @@ public void getSettingsShouldReturnSettings() { @Test public void getTransactionsShouldReturnThePaginatorCount() throws Exception { String responseString = "[ { \"id\": \"FOOBAR\" }, { \"id\": \"FOOBIZ\" } ]"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, new HashMap() {{ + MockRestAdapter adapter = new MockRestAdapter<>(responseString, new HashMap() {{ put("Content-Range", "0-2/60"); }}); @@ -437,7 +437,7 @@ public Promise call(List transactions) { @Test public void getTransactionsShouldReturnThePaginatorHasNext() throws Exception { String responseString = "[ { \"id\": \"FOOBAR\" }, { \"id\": \"FOOBIZ\" } ]"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, new HashMap() {{ + MockRestAdapter adapter = new MockRestAdapter<>(responseString, new HashMap() {{ put("Content-Range", "0-49/51"); }}); @@ -474,7 +474,7 @@ public Promise call(List transactions) { @Test public void getTransactionsShouldReturnTheListOfTransactions() throws Exception { String responseString = "[ { \"id\": \"FOOBAR\" }, { \"id\": \"FOOBIZ\" } ]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -511,7 +511,7 @@ public Promise> call(List transactions) { @Test public void getTransactionsShouldReturnThePaginatorNextPage() throws Exception { String responseString = "[ { \"id\": \"FOOBAR\" }, { \"id\": \"FOOBIZ\" } ]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -544,7 +544,7 @@ public Promise> call(List transactions) { @Test public void updateShouldReturnPromiseWithCard() throws Exception { String responseString = "{ \"id\": \"FOOBAR\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override diff --git a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/ReserveTest.java b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/ReserveTest.java index a8293c4..e8cf57c 100644 --- a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/ReserveTest.java +++ b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/ReserveTest.java @@ -36,7 +36,7 @@ public class ReserveTest { @Test public void getLedgerShouldReturnThePaginatorCount() throws Exception { String responseString = "[ { \"type\": \"asset\" }, { \"type\": \"liability\" } ]"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, new HashMap() {{ + MockRestAdapter adapter = new MockRestAdapter<>(responseString, new HashMap() {{ put("Content-Range", "0-2/60"); }}); @@ -71,7 +71,7 @@ public Promise call(List transactions) { @Test public void getLedgerShouldReturnThePaginatorHasNext() throws Exception { String responseString = "[ { \"type\": \"asset\" }, { \"type\": \"liability\" } ]"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, new HashMap() {{ + MockRestAdapter adapter = new MockRestAdapter<>(responseString, new HashMap() {{ put("Content-Range", "0-49/51"); }}); @@ -129,7 +129,7 @@ public void getLedgerShouldReturnTheListWithDeposits() throws Exception { "\"TransactionId\": \"foobar\"," + "\"createdAt\": \"2015-04-20T14:57:12.398Z\"" + "}]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -176,7 +176,7 @@ public Promise> call(List transactions) { @Test public void getLedgerShouldReturnThePaginatorNextPage() throws Exception { String responseString = "[ { \"type\": \"asset\" }, { \"type\": \"liability\" } ]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -235,7 +235,7 @@ public void getStatisticsShouldReturnTheListWithReserveStatistics() throws Excep "\"liabilities\": \"buz\"" + "}" + "}]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -279,7 +279,7 @@ public Promise> call(UpholdRestAdapter adapter) { @Test public void getTransactionsByIdShouldReturnTheTransaction() throws Exception { String responseString = "{ \"id\": \"FOOBAR\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -303,7 +303,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void getTransactionsShouldReturnThePaginatorCount() throws Exception { String responseString = "[ { \"id\": \"FOOBAR\" }, { \"id\": \"FOOBIZ\" } ]"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, new HashMap() {{ + MockRestAdapter adapter = new MockRestAdapter<>(responseString, new HashMap() {{ put("Content-Range", "0-2/60"); }}); @@ -338,7 +338,7 @@ public Promise call(List transactions) { @Test public void getTransactionsShouldReturnThePaginatorHasNext() throws Exception { String responseString = "[ { \"id\": \"FOOBAR\" }, { \"id\": \"FOOBIZ\" } ]"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, new HashMap() {{ + MockRestAdapter adapter = new MockRestAdapter<>(responseString, new HashMap() {{ put("Content-Range", "0-49/51"); }}); @@ -373,7 +373,7 @@ public Promise call(List transactions) { @Test public void getTransactionsShouldReturnTheListOfTransactions() throws Exception { String responseString = "[ { \"id\": \"FOOBAR\" }, { \"id\": \"FOOBIZ\" } ]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -408,7 +408,7 @@ public Promise> call(List transactions) { @Test public void getTransactionsShouldReturnThePaginatorNextPage() throws Exception { String responseString = "[ { \"id\": \"FOOBAR\" }, { \"id\": \"FOOBIZ\" } ]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override diff --git a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/TransactionTest.java b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/TransactionTest.java index 543f9dc..6b09c54 100644 --- a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/TransactionTest.java +++ b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/TransactionTest.java @@ -34,7 +34,7 @@ public class TransactionTest { @Test public void cancelShouldReturnALogicExceptionIfCardIdIsMissing() throws Exception { - MockRestAdapter adapter = new MockRestAdapter<>("foobar", null, null); + MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -59,7 +59,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void cancelShouldReturnALogicExceptionIfDestinationCardIdIsMissingForDeposits() throws Exception { - MockRestAdapter adapter = new MockRestAdapter<>("foobar", null, null); + MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -83,7 +83,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void cancelShouldReturnALogicExceptionIfOriginAccountIdIsMissingForDeposits() throws Exception { - MockRestAdapter adapter = new MockRestAdapter<>("foobar", null, null); + MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -107,7 +107,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void cancelShouldReturnTheLogicExceptionUncommitedTransaction() throws Exception { - MockRestAdapter adapter = new MockRestAdapter<>("foobar", null, null); + MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -130,7 +130,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void cancelShouldReturnTheLogicExceptionWhenTransactionStatusIsNotWaiting() throws Exception { - MockRestAdapter adapter = new MockRestAdapter<>("foobar", null, null); + MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -154,7 +154,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void cancelShouldReturnTheTransaction() throws Exception{ String responseString = "{ \"id\": \"foobar\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -181,7 +181,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void commitShouldReturnTheLogicExceptionCardIdIsMissing() throws Exception { - MockRestAdapter adapter = new MockRestAdapter<>("foobar", null, null); + MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -206,7 +206,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void commitShouldReturnTheLogicExceptionIfDestinationCardIdIsMissingForDeposits() throws Exception { - MockRestAdapter adapter = new MockRestAdapter<>("foobar", null, null); + MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -230,7 +230,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void commitShouldReturnTheLogicExceptionIfOriginAccountIdIsMissingForDeposits() throws Exception { - MockRestAdapter adapter = new MockRestAdapter<>("foobar", null, null); + MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -254,7 +254,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void commitShouldReturnTheLogicExceptionTransactionCouldNotBeCommited() throws Exception { - MockRestAdapter adapter = new MockRestAdapter<>("foobar", null, null); + MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -280,7 +280,7 @@ public void commitWithMessageShouldReturnTheTransaction() throws Exception { ByteArrayOutputStream bodyOutput = new ByteArrayOutputStream(); String responseString = "{ \"id\": \"foobar\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -323,7 +323,7 @@ public void commitWithMessageAndOTPShouldReturnTheTransaction() throws Exception ByteArrayOutputStream bodyOutput = new ByteArrayOutputStream(); String responseString = "{ \"id\": \"foobar\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -366,7 +366,7 @@ public void commitWithMessageAndSecurityCodeShouldReturnTheTransaction() throws ByteArrayOutputStream bodyOutput = new ByteArrayOutputStream(); String responseString = "{ \"id\": \"foobar\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -409,7 +409,7 @@ public void commitWithOTPShouldReturnTheTransaction() throws Exception { ByteArrayOutputStream bodyOutput = new ByteArrayOutputStream(); String responseString = "{ \"id\": \"foobar\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -452,7 +452,7 @@ public void commitShouldReturnTheTransaction() throws Exception { ByteArrayOutputStream bodyOutput = new ByteArrayOutputStream(); String responseString = "{ \"id\": \"foobar\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override diff --git a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/UserTest.java b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/UserTest.java index 38a859d..caaa538 100644 --- a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/UserTest.java +++ b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/model/UserTest.java @@ -65,7 +65,7 @@ public void createCardShouldReturnTheCard() throws Exception { "\"starred\": true" + "}" + "}"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -103,7 +103,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void createContactShouldReturnTheContact() throws Exception { String responseString = "{\"id\": \"FOOBAR\", \"firstName\": \"Foo\", \"lastName\": \"Bar\", \"company\": \"FOO\", \"emails\": [\"foo@bar.org\"], \"addresses\": [\"foobiz\"], \"name\": \"Foo Bar\"}"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -135,7 +135,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void createDocumentShouldReturnTheDocument() throws Exception { String responseString = "{\"type\": \"foo\", \"value\": \"bar\"}"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -160,7 +160,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void getAccountByIdShouldReturnTheAccountWithId() throws Exception { String responseString = "{ \"currency\": \"FOO\", \"id\": \"FOOBAR\", \"label\": \"BAR\", \"status\": \"FOO BAR\", \"type\": \"Bar\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -188,7 +188,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void getAccountsShouldReturnTheListOfAccounts() throws Exception { String responseString = "[ { \"id\": \"FOO\" }, { \"id\": \"BAR\" } ]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -214,7 +214,7 @@ public Promise> call(UpholdRestAdapter adapter) { @Test public void getBalancesShouldReturnTheListOfBalances() throws Exception { String responseString = "{ \"balances\": { \"total\": \"1083.77\", \"currencies\": { \"CNY\": { \"amount\": \"6.98\" }, \"EUR\": { \"amount\": \"75.01\" } } } }"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -258,7 +258,7 @@ public void getBalanceByCurrencyShouldReturnTheCurrency() throws Exception { "}" + "}" + "}"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -285,7 +285,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void getCardsShouldReturnTheListOfCards() throws Exception { String responseString = "[ { \"id\": \"FOO\" }, { \"id\": \"BAR\" } ]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -311,7 +311,7 @@ public Promise> call(UpholdRestAdapter adapter) { @Test public void getCardByIdShouldReturnTheCardWithId() throws Exception { String responseString = "{ \"id\": \"FOOBAR\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -335,7 +335,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void getCardsByCurrencyShouldReturnTheListOfCardsWithCurrency() throws Exception { String responseString = "[ { \"id\": \"FOOBAR\", \"currency\": \"USD\" }, { \"id\": \"FOOBIZ\", \"currency\": \"BTC\" } ]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -382,7 +382,7 @@ public void getContactsShouldReturnTheListOfContacts() throws Exception { "\"name\": \"Fuz Buz\"" + "}" + "]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -441,7 +441,7 @@ public void getCurrenciesShouldReturnTheListOfCurrencies() { @Test public void getDocumentsShouldReturnTheListOfDocuments() throws Exception { String responseString = "[{\"type\": \"foo\", \"value\": \"bar\"}]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -510,7 +510,7 @@ public void getPhonesShouldReturnTheListOfPhones() throws Exception { "\"e164Masked\": \"+XXXXXXXXX04\"" + "}" + "]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -603,7 +603,7 @@ public void getTotalBalancesShouldReturnTheTotalBalance() throws Exception { "}" + "}" + "}"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override @@ -635,7 +635,7 @@ public Promise call(UpholdRestAdapter adapter) { @Test public void getUserTransactionsShouldReturnThePaginatorCount() throws Exception { String responseString = "[ { \"id\": \"FOOBAR\" }, { \"id\": \"FOOBIZ\" } ]"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, new HashMap() {{ + MockRestAdapter adapter = new MockRestAdapter<>(responseString, new HashMap() {{ put("Content-Range", "0-2/60"); }}); @@ -670,7 +670,7 @@ public Promise call(List transactions) { @Test public void getUserTransactionsShouldReturnThePaginatorHasNext() throws Exception { String responseString = "[ { \"id\": \"FOOBAR\" }, { \"id\": \"FOOBIZ\" } ]"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, new HashMap() {{ + MockRestAdapter adapter = new MockRestAdapter<>(responseString, new HashMap() {{ put("Content-Range", "0-49/51"); }}); @@ -705,7 +705,7 @@ public Promise call(List transactions) { @Test public void getUserTransactionsShouldReturnTheListOfTransactions() throws Exception { String responseString = "[ { \"id\": \"FOOBAR\" }, { \"id\": \"FOOBIZ\" } ]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -740,7 +740,7 @@ public Promise> call(List transactions) { @Test public void getUserTransactionsShouldReturnThePaginatorNextPage() throws Exception { String responseString = "[ { \"id\": \"FOOBAR\" }, { \"id\": \"FOOBIZ\" } ]"; - MockRestAdapter> adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter> adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction>() { @Override @@ -820,7 +820,7 @@ public void getVerificationsShouldReturnTheVerifications() { @Test public void updateShouldReturnTheUser() throws Exception { String responseString = "{ \"username\": \"FOOBAR\" }"; - MockRestAdapter adapter = new MockRestAdapter<>("foobar", responseString, null); + MockRestAdapter adapter = new MockRestAdapter<>(responseString, null); adapter.request(new RepromiseFunction() { @Override diff --git a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/AccountServiceTest.java b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/AccountServiceTest.java index e8525a7..522d301 100644 --- a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/AccountServiceTest.java +++ b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/AccountServiceTest.java @@ -31,7 +31,7 @@ public class AccountServiceTest { @Test public void getUserAccountByIdShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -53,7 +53,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void getUserAccountsShouldReturnTheRequest() throws Exception { - final MockRestAdapter> adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter> adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction>() { @Override diff --git a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/OAuth2ServiceTest.java b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/OAuth2ServiceTest.java index 3a78c93..5471248 100644 --- a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/OAuth2ServiceTest.java +++ b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/OAuth2ServiceTest.java @@ -1,22 +1,22 @@ package com.uphold.uphold_android_sdk.test.integration.service; +import android.support.test.runner.AndroidJUnit4; +import android.test.suitebuilder.annotation.SmallTest; + import com.darylteo.rx.promises.java.Promise; import com.darylteo.rx.promises.java.functions.RepromiseFunction; - -import junit.framework.Assert; - import com.uphold.uphold_android_sdk.client.restadapter.UpholdRestAdapter; import com.uphold.uphold_android_sdk.client.retrofitpromise.RetrofitPromise; import com.uphold.uphold_android_sdk.model.AuthenticationResponse; import com.uphold.uphold_android_sdk.service.OAuth2Service; import com.uphold.uphold_android_sdk.test.BuildConfig; import com.uphold.uphold_android_sdk.test.util.MockRestAdapter; + +import junit.framework.Assert; + import org.junit.Test; import org.junit.runner.RunWith; -import android.support.test.runner.AndroidJUnit4; -import android.test.suitebuilder.annotation.SmallTest; - import java.io.ByteArrayOutputStream; import retrofit.client.Header; @@ -33,7 +33,7 @@ public class OAuth2ServiceTest { @Test public void requestToken() throws Exception { ByteArrayOutputStream bodyOutput = new ByteArrayOutputStream(); - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override diff --git a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/ReserveServiceTest.java b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/ReserveServiceTest.java index 96fe210..428c767 100644 --- a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/ReserveServiceTest.java +++ b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/ReserveServiceTest.java @@ -35,7 +35,7 @@ public class ReserveServiceTest { @Test public void getLedgerShouldReturnTheRequest() throws Exception { - final MockRestAdapter> adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter> adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction>() { @Override @@ -58,7 +58,7 @@ public Promise> call(UpholdRestAdapter upholdRestAdapter) { @Test public void getReserveTransactionByIdShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -80,7 +80,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void getReserveTransactionsShouldReturnTheRequest() throws Exception { - final MockRestAdapter> adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter> adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction>() { @Override @@ -103,7 +103,7 @@ public Promise> call(UpholdRestAdapter upholdRestAdapter) { @Test public void getReserveStatisticsShouldReturnTheRequest() throws Exception { - final MockRestAdapter> adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter> adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction>() { @Override diff --git a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/TickerServiceTest.java b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/TickerServiceTest.java index 4c8b009..5aed127 100644 --- a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/TickerServiceTest.java +++ b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/TickerServiceTest.java @@ -31,7 +31,7 @@ public class TickerServiceTest { @Test public void getAllTickersShouldReturnTheRequest() throws Exception { - final MockRestAdapter> adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter> adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction>() { @Override @@ -53,7 +53,7 @@ public Promise> call(UpholdRestAdapter upholdRestAdapter) { @Test public void getAllTickersByCurrencyShouldReturnTheRequest() throws Exception { - final MockRestAdapter> adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter> adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction>() { @Override diff --git a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/UserCardServiceTest.java b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/UserCardServiceTest.java index baf9ba1..b2e6b22 100644 --- a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/UserCardServiceTest.java +++ b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/UserCardServiceTest.java @@ -44,7 +44,7 @@ public class UserCardServiceTest { @Test public void cancelTransactionShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -66,7 +66,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void confirmTransactionShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -98,7 +98,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void createAddressShouldReturnTheRequest() throws Exception { - final MockRestAdapter
adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter
adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -120,7 +120,7 @@ public Promise
call(UpholdRestAdapter upholdRestAdapter) { @Test public void createTransactionCardDepositShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -142,7 +142,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void createTransactionDepositShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -164,7 +164,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void createTransactionTransferShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -186,7 +186,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void createUserCardShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -208,7 +208,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void createUserCardWithSettingsShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -230,7 +230,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void getUserCardByIdShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -252,7 +252,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void getUserCardsShouldReturnTheRequest() throws Exception { - final MockRestAdapter> adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter> adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction>() { @Override @@ -274,7 +274,7 @@ public Promise> call(UpholdRestAdapter upholdRestAdapter) { @Test public void getUserCardTransactionsShouldReturnTheRequest() throws Exception { - final MockRestAdapter> adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter> adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction>() { @Override @@ -297,7 +297,7 @@ public Promise> call(UpholdRestAdapter upholdRestAdapter) { @Test public void updateShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override diff --git a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/UserServiceTest.java b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/UserServiceTest.java index ed81703..ee780b3 100644 --- a/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/UserServiceTest.java +++ b/src/app/src/androidTest/java/com/uphold/uphold_android_sdk/test/integration/service/UserServiceTest.java @@ -39,7 +39,7 @@ public class UserServiceTest { @Test public void createContactShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -61,7 +61,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void createDocumentShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -83,7 +83,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void getDocumentsShouldReturnTheRequest() throws Exception { - final MockRestAdapter> adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter> adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction>() { @Override @@ -105,7 +105,7 @@ public Promise> call(UpholdRestAdapter upholdRestAdapter) { @Test public void getUserShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -127,7 +127,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void getUserBalancesShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override @@ -149,7 +149,7 @@ public Promise call(UpholdRestAdapter upholdRestAdapter) { @Test public void getUserContactsShouldReturnTheRequest() throws Exception { - final MockRestAdapter> adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter> adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction>() { @Override @@ -171,7 +171,7 @@ public Promise> call(UpholdRestAdapter upholdRestAdapter) { @Test public void getUserPhonesShouldReturnTheRequest() throws Exception { - final MockRestAdapter> adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter> adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction>() { @Override @@ -193,7 +193,7 @@ public Promise> call(UpholdRestAdapter upholdRestAdapter) { @Test public void getUserTransactionsShouldReturnTheRequest() throws Exception { - final MockRestAdapter> adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter> adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction>() { @Override @@ -216,7 +216,7 @@ public Promise> call(UpholdRestAdapter upholdRestAdapter) { @Test public void updateUserShouldReturnTheRequest() throws Exception { - final MockRestAdapter adapter = new MockRestAdapter<>(null, null, null); + final MockRestAdapter adapter = new MockRestAdapter<>(null, null); adapter.request(new RepromiseFunction() { @Override