Skip to content

Instantly share code, notes, and snippets.

@stephan-mueller
Created September 29, 2015 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephan-mueller/8a524bd7cc42602967f2 to your computer and use it in GitHub Desktop.
Save stephan-mueller/8a524bd7cc42602967f2 to your computer and use it in GitHub Desktop.
Test class for the builder {@link CustomerBuilder} with Hamcrest assertions
public class CustomerBuilderHamcrestTest {
private Customer customer;
@Before
public void setUp() throws Exception {
customer = Customer.newBuilder()
.setFirstName("Max")
.setLastName("Mustermann")
.setEmail("max.mustermann@openknowledge.de")
.build();
}
@Test
public void build() throws Exception {
assertThat(customer, notNullValue());
assertThat(customer.getFirstName(), equalTo("Max"));
assertThat(customer.getLastName(), equalTo("Mustermann"));
assertThat(customer.getEmail(), equalTo("max.mustermann@openknowledge.de"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment