Assert regex matches in JUnit

前端 未结 9 1234
广开言路
广开言路 2020-12-13 01:40

Ruby\'s Test::Unit has a nice assert_matches method that can be used in unit tests to assert that a regex matches a string.

Is there anythi

9条回答
  •  情深已故
    2020-12-13 02:02

    A matcher similar to Ralph's implementation has been added to the official Java Hamcrest matchers library. Unfortunately, it's not yet available in a release package. The class is on GitHub though if you want a look.

提交回复
热议问题