Combine two printers into a single printer.
Combine two printers into a single printer.
Order is important : this printer will be tried first, then the other printer. The new Printer's height will be the max of the two printers' heights.
Example use case : define some default printers for some types for all tests, and override it for some tests only.
case class Person(name: String, age: Int, mail: String) trait MySuites extends FunSuite { override val printer = Printer.apply { case Person(name, age, mail) => s"$name:$age:$mail" case m: SomeOtherCaseClass => m.someCustomToString } } trait CompareMailsOnly extends MySuites { val mailOnlyPrinter = Printer.apply { case Person(_, _, mail) => mail } override val printer = mailOnlyPrinterPrinter orElse super.printer }
Implement this trait to customize the default printer