Skip to content

Commit 9e4eacf

Browse files
committed
Add and fix tests
1 parent af7b1b1 commit 9e4eacf

File tree

6 files changed

+63
-3
lines changed

6 files changed

+63
-3
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ before_install:
1818
env:
1919
global:
2020
# If changing this number, please also change it in `BaseStripeTest.java`.
21-
- STRIPE_MOCK_VERSION=0.98.0
21+
- STRIPE_MOCK_VERSION=0.99.0
2222

2323
matrix:
2424
include:

src/test/java/com/stripe/BaseStripeTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
public class BaseStripeTest {
3535
// If changing this number, please also change it in `.travis.yml`.
36-
private static final String MOCK_MINIMUM_VERSION = "0.98.0";
36+
private static final String MOCK_MINIMUM_VERSION = "0.99.0";
3737

3838
private static String port;
3939

src/test/java/com/stripe/functional/ProductTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public void testCreate() throws StripeException {
4242
params.put("url", "http://example.com");
4343
params.put("shippable", true);
4444
params.put("package_dimensions", packageDimensions);
45-
params.put("type", "good");
4645

4746
final Product product = Product.create(params);
4847

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.stripe.functional;
2+
3+
import static org.junit.jupiter.api.Assertions.assertNotNull;
4+
5+
import com.stripe.BaseStripeTest;
6+
import com.stripe.exception.StripeException;
7+
import com.stripe.model.SetupAttempt;
8+
import com.stripe.model.SetupAttemptCollection;
9+
import com.stripe.net.ApiResource;
10+
import java.util.HashMap;
11+
import java.util.Map;
12+
import org.junit.jupiter.api.Test;
13+
14+
public class SetupAttemptTest extends BaseStripeTest {
15+
@Test
16+
public void testList() throws StripeException {
17+
final Map<String, Object> params = new HashMap<>();
18+
params.put("setup_intent", "seti_123");
19+
20+
final SetupAttemptCollection setupAttempts = SetupAttempt.list(params);
21+
22+
assertNotNull(setupAttempts);
23+
verifyRequest(ApiResource.RequestMethod.GET, String.format("/v1/setup_attempts"), params);
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.stripe.model;
2+
3+
import static org.junit.jupiter.api.Assertions.assertNotNull;
4+
5+
import com.stripe.BaseStripeTest;
6+
import com.stripe.net.ApiResource;
7+
import org.junit.jupiter.api.Test;
8+
9+
public class SetupAttemptTest extends BaseStripeTest {
10+
@Test
11+
public void testDeserialize() throws Exception {
12+
// Keep the fixture to have `action` deserialize properly
13+
final SetupAttempt resource =
14+
ApiResource.GSON.fromJson(
15+
getResourceAsString("/api_fixtures/setup_attempt.json"), SetupAttempt.class);
16+
assertNotNull(resource);
17+
assertNotNull(resource.getId());
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"id": "setatt_123",
3+
"object": "setup_attempt",
4+
"application": "ca_123",
5+
"created": 1562004309,
6+
"customer": "cus_123",
7+
"livemode": false,
8+
"on_behalf_of": "acct_123",
9+
"payment_method": "pm_123",
10+
"payment_method_details": {
11+
"type": "card"
12+
},
13+
"setup_error": null,
14+
"setup_intent": "seti_123",
15+
"status": "succeeded",
16+
"usage": "off_session"
17+
}

0 commit comments

Comments
 (0)