Skip to content

Commit

Permalink
#19: Seperated customer name and email update into 2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mats Stijlaart committed Oct 27, 2016
1 parent cf7947e commit 920b1b0
Showing 1 changed file with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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]"));
}


}

0 comments on commit 920b1b0

Please sign in to comment.