8000 zio.test.PrettyPrint `NullPointerException` when trying to render output · Issue #5790 · zio/zio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
zio.test.PrettyPrint NullPointerException when trying to render output #5790
Closed
@reibitto

Description

@reibitto

Sorry @kitlangton, I mentioned this on the Discord but took me a while to get back to it to create a small reproducer. The NullPointerException started happening with 1.0.12. It looks like it happens when trying to introspect fields in case classes that are null. For example:

test("foo") {
  assertTrue(Foo(null, 1) == Foo("a", 1))
}

will produce:

zio.FiberFailure: Fiber failed.
An unchecked error was produced
java.lang.NullPointerException
        at zio.test.PrettyPrint$.apply(PrettyPrint.scala:45)
        at zio.test.PrettyPrint$.$anonfun$apply$4(PrettyPrint.scala:32)
        at scala.collection.Iterator$$anon$9.next(Iterator.scala:575)
        at scala.collection.immutable.List.prependedAll(List.scala:153)
        at scala.collection.IterableOnceOps.toList(IterableOnce.scala:1251)
        at scala.collection.IterableOnceOps.toList$(IterableOnce.scala:1251)
        at scala.collection.AbstractIterator.toList(Iterator.scala:1288)
        at zio.test.PrettyPrint$.apply(PrettyPrint.scala:31)
        at zio.test.FailureCase$.$anonfun$renderFailureCase$6(Result.scala:140)
...

This only happens with the smart asserts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0