-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#19: Move tests to concepts package and change PUT to POST
- Loading branch information
Mats Stijlaart
committed
Oct 27, 2016
1 parent
e1cfad2
commit cf7947e
Showing
3 changed files
with
20 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
package nl.stil4m.mollie; | ||
package nl.stil4m.mollie.concepts; | ||
|
||
import nl.stil4m.mollie.Client; | ||
import nl.stil4m.mollie.ClientBuilder; | ||
import nl.stil4m.mollie.ResponseOrError; | ||
import nl.stil4m.mollie.domain.CreateCustomer; | ||
import nl.stil4m.mollie.domain.CreatePayment; | ||
import nl.stil4m.mollie.domain.Customer; | ||
|
@@ -25,20 +28,19 @@ | |
public class CustomerPaymentsIntegrationTest { | ||
|
||
private Client client; | ||
private Map<String,Object> defaultMetadata; | ||
private Customer customer; | ||
|
||
@Before | ||
public void before() throws InterruptedException, IOException { | ||
Thread.sleep(TEST_TIMEOUT); | ||
client = new ClientBuilder().withApiKey(VALID_API_KEY).build(); | ||
|
||
defaultMetadata = new HashMap<>(); | ||
Map<String, Object> defaultMetadata = new HashMap<>(); | ||
defaultMetadata.put("foo", "bar"); | ||
|
||
String uuid = UUID.randomUUID().toString(); | ||
String name = "Test Customer " + uuid; | ||
customer = client.customers().create(new CreateCustomer(name, "[email protected]", Optional.empty(), null)).getData(); | ||
customer = client.customers().create(new CreateCustomer(name, "[email protected]", Optional.empty(), defaultMetadata)).getData(); | ||
} | ||
|
||
@Test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
package nl.stil4m.mollie; | ||
package nl.stil4m.mollie.concepts; | ||
|
||
import nl.stil4m.mollie.Client; | ||
import nl.stil4m.mollie.ClientBuilder; | ||
import nl.stil4m.mollie.ResponseOrError; | ||
import nl.stil4m.mollie.domain.CreateCustomer; | ||
import nl.stil4m.mollie.domain.Customer; | ||
import nl.stil4m.mollie.domain.Page; | ||
|
@@ -19,10 +22,10 @@ | |
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
public class CustomersIntegerationTest { | ||
public class CustomersIntegrationTest { | ||
|
||
private Client client; | ||
private Map<String,Object> defaultMetadata; | ||
private Map<String, Object> defaultMetadata; | ||
|
||
@Before | ||
public void before() throws InterruptedException { | ||
|
@@ -57,22 +60,23 @@ public void testCreateCustomer() throws IOException, URISyntaxException { | |
} | ||
|
||
@Test | ||
public void testGetCustomer() throws IOException, URISyntaxException { | ||
public void testGetCustomer() throws IOException, URISyntaxException { | ||
String uuid = UUID.randomUUID().toString(); | ||
String originalName= "Test Customer " + uuid; | ||
String originalName = "Test Customer " + uuid; | ||
ResponseOrError<Customer> createdCustomer = client.customers().create(new CreateCustomer(originalName, "[email protected]", Optional.empty(), defaultMetadata)); | ||
|
||
ResponseOrError<Customer> fetchedCustomer = client.customers().get(createdCustomer.getData().getId()); | ||
assertThat(fetchedCustomer.getData().getName(),is(originalName)); | ||
assertThat(fetchedCustomer.getData().getName(), is(originalName)); | ||
//TODO Expand | ||
} | ||
|
||
@Test | ||
public void testUpdateCustomer() throws IOException, URISyntaxException { | ||
String uuid = UUID.randomUUID().toString(); | ||
String uuid2 = UUID.randomUUID().toString(); | ||
String originalName = "Test Customer " + uuid; | ||
String newName = "Test Customer " + uuid2; | ||
ResponseOrError<Customer> createdCustomer = client.customers().create(new CreateCustomer(originalName, "[email protected]", Optional.empty(), null)); | ||
ResponseOrError<Customer> createdCustomer = client.customers().create(new CreateCustomer(originalName, "[email protected]", Optional.empty(), null)); | ||
|
||
ResponseOrError<Customer> update = client.customers().update(createdCustomer.getData().getId(), new UpdateCustomer( | ||
Optional.of(newName), | ||
|