Skip to content

Instantly share code, notes, and snippets.

@mroger
Last active June 1, 2016 00:56
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 mroger/155c992147f4851bb2dbbb2e53aa0a3f to your computer and use it in GitHub Desktop.
Save mroger/155c992147f4851bb2dbbb2e53aa0a3f to your computer and use it in GitHub Desktop.
Test class using custom matcher
public class PersonTest {
private Person person;
@Before
public void setUp() {
person = new Person();
}
@Test
public void shouldMatchCriteriaDynamicProxyWay() {
person.setName("Bruce Wayne");
person.setAge(15);
List<String> options = Arrays.asList(new String[] {"1", "2", "3"});
person.setOptions(options);
assertThat(person, aPerson()
.withName("Bruce Wayne")
.withAge(lessThan(20))
.withOptions(Arrays.asList(new String[] {"1", "2", "3"})));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment