atrium icon indicating copy to clipboard operation
atrium copied to clipboard

change report for notToEqualNull

Open robstoll opened this issue 5 years ago • 0 comments

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
◆ is instance of type: List (kotlin.collections.List) -- Class: java.util.List
  » is: empty

And we would like to see the following instead

expect: null
◆ is not: null but is instance of: List (kotlin.collections.List) -- Class: (java.util.List)
  » is: 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 notToBe treat null specially so that expect(null as List<Int>?).notToBe(null) also results in the reporting above (without is: empty of course)

Please react with :+1: 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.

robstoll avatar Jan 25 '20 10:01 robstoll