- Make sure
Diffable.forFields[T]
is consistent withT.equals
containElements
has been dropped in favor of traversable diffables- Improved formatting of traversable matchers
- Improved readability of failure messages
- Improved readability of failure messages
- Improved readability of failure messages
- Removed useless trait
Formatters
- Fix Diffable generation for polymorphic case classes (such as TupleN)
- Add a
Diffable[Set[T]]
-
Split matchete into multiple artefacts:
- matchete-junit (depends on core)
- matchete-json (depends on core)
- matchete-xml (depends on core)
- matchete-core (depends on macros)
- matchete-macros
People should therefore change their dependency toward
matchete-junit
.
- Removed
MatcherComparator[Seq[T]]
in favor ofDiffable[Seq[T]]
as the latest is more composable
-
Added JSON matchers:
"""{ | "firstName": "john", | "lastName":"doe", "age":43 |} """.stripMargin must equalJson( """{ | "nationality": "cowboy", | "firstName": "john doe" |} """.stripMargin)
- Fixed build configuration, the published matchete POM was incorrect and the macros weren't published.
- Collection matchers now accept
TraversableOnce
, which make it possible to match against anIterator
-
Added diffable support. Comparisons of case classes are now done on a field by field basis.
case class Person(name: String, age: Int, address: Address) case class Address(street: String) Person("john",12, Address("street")) must_== Person("john",12,Address("different street"))
Will throw the following
ComparisonFailure
(withJunitMatchers
):org.junit.ComparisonFailure: Person(john,12,Address(street)) is not equal to Person(john,12,Address(different street)) address.street = street ≠ address.street = different street Expected :different street Actual :street
Non case-classes are by default using standard equality but there's a facility for customization:
class Person(val name: String, val age: Int, val address: Address) class Address(val street: String) implicit lazy val diffablePerson : Diffable[Person] = Diffable.forFields(_.name, _.age, _.address) implicit lazy val diffableAddress : Diffable[Address] = Diffable.forFields(_.street) new Person("john",12, new Address("street")) must_== new Person("john",12,new Address("different street"))
Will throw the following
ComparisonFailure
(withJunitMatchers
):org.junit.ComparisonFailure: org.backuity.matchete.XX$Person@46d56d67 is not equal to org.backuity.matchete.XX$Person@d8355a8 address.street = street ≠ address.street = different street Expected :different street Actual :street
- Add
with
to exception matchers :
parse() must throwA[ParsingError].`with`("a correct offset") { case ParsingError(msg,offset) => offset must_== 3 }