-
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: Seperated customer name and email update into 2 tests
- Loading branch information
Mats Stijlaart
committed
Oct 27, 2016
1 parent
cf7947e
commit 920b1b0
Showing
1 changed file
with
23 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,25 @@ public void testGetCustomer() throws IOException, URISyntaxException { | |
} | ||
|
||
@Test | ||
public void testUpdateCustomer() throws IOException, URISyntaxException { | ||
public void testUpdateCustomerEmail() throws IOException, URISyntaxException { | ||
String uuid = UUID.randomUUID().toString(); | ||
String originalName = "Test Customer " + uuid; | ||
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.empty(), | ||
Optional.of("[email protected]"), | ||
Optional.empty(), | ||
defaultMetadata | ||
)); | ||
|
||
assertThat(update.getSuccess(), is(true)); | ||
assertThat(update.getData().getName(), is(originalName)); | ||
assertThat(update.getData().getEmail(), is("[email protected]")); | ||
} | ||
|
||
@Test | ||
public void testUpdateCustomerName() throws IOException, URISyntaxException { | ||
String uuid = UUID.randomUUID().toString(); | ||
String uuid2 = UUID.randomUUID().toString(); | ||
String originalName = "Test Customer " + uuid; | ||
|
@@ -80,13 +98,15 @@ public void testUpdateCustomer() throws IOException, URISyntaxException { | |
|
||
ResponseOrError<Customer> update = client.customers().update(createdCustomer.getData().getId(), new UpdateCustomer( | ||
Optional.of(newName), | ||
Optional.of("[email protected]"), | ||
Optional.empty(), | ||
Optional.empty(), | ||
defaultMetadata | ||
)); | ||
|
||
assertThat(update.getSuccess(), is(true)); | ||
assertThat(update.getData().getName(), is(newName)); | ||
assertThat(update.getData().getEmail(), is("test+2@foobar.nl")); | ||
assertThat(update.getData().getEmail(), is("[email protected]")); | ||
} | ||
|
||
|
||
} |