Skip to content

Instantly share code, notes, and snippets.

@childnode
Last active August 31, 2016 11:27
Show Gist options
  • Save childnode/295dbd6e1ce3f90abe4b15cb10366650 to your computer and use it in GitHub Desktop.
Save childnode/295dbd6e1ce3f90abe4b15cb10366650 to your computer and use it in GitHub Desktop.
JUnit to JUnit hamcrest - assertThat(sth, hasSize(expectedSize)) using org.hamcrest.MatcherAssert.assertThat and org.hamcrest.Matchers.hasSize
s
|
assertNotNull\((?:\s*([^,;$]+))\s*\)
|
assertThat\($1, notNullValue\(\)\)
|
s
|
assertEquals\((?:(\d+)\s*),(?:\s*([^,;$]+))\.size\(\)\)
|
assertThat\($2, hasSize\($1\)\)
|
s
|
assertEquals\((?:([^,]+)\s*),(?:\s*([^,;$]+))\)
|
assertThat\($2, is\($1\)\)
|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment