Skip to content

change report for notToEqualNull #330

@robstoll

Description

@robstoll

Platform (jvm, js, android):
Extension (none, kotlin 1.3, jdk8): none

Code related feature

expect(null as List<Int>?).notToEqualNull {
  toBeEmpty()
}

For this we currently see in reporting

expect: null
◆ to be an instance of type: List (kotlin.collections.List) -- Class: java.util.List
  » to be: empty

And we would like to see the following instead

expect: null
◆ not to equal: null but to be an instance of: List (kotlin.collections.List) -- Class: (java.util.List)
  » to be: empty

This means notToEqualNull has to do more than just delegating to toBeAnInstanceOf hence:

  • don't delegate simply to isA in DefaultAnyAssertions.notToBeNullBut
  • copy implementation of isA but change the options, to be more precise, change the description and the representation
  • change the implementation of notToEqual treat null specially so that expect(null as List<Int>?).notToBe(null) also results in the reporting above (without to be: empty of course) => we would need to break the API in order that this works. Won't do it now

Please react with 👍 if you would like to see this feature implemented in Atrium, the more upvotes the more likely I will implement it myself -- feel free to sponsor me, that would be a motivation too.
You are of course welcome to work on this issue. Write I'll work on it as comment so that we can assign the task to you.

Metadata

Metadata

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions