-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad assertion of array of objects #465
Comments
Hi, thanks for reporting. Will try to fix that. The issue is caused by the fact that by calling |
Latest findings. On the other hand it should break backward compatibility only for the methods that do not work anyway, so it may be possible to do. Have to investigate further. |
Bad news. In order to change the assert, we would have to change the ELEMENT type in the So the only way out of it is to mark those methods as deprecated and recommend using Json compatible alternatives. |
And we can't even deprecate it since we are using the original ListAssert as return type of isArray. |
Fixed in 2.30.0 |
@lukas-krecan I approve your decision to change return type of But 2.30.0 version broke a lot of code, related to I've come up with issue, that migrating the old code to the new API assertThatJson("""[{"foo": "bar baz"}]""").isArray
.first()
.extracting("foo")
.asString()
.isEqualTo("bar baz") seems impossible. It'll be good to have something like assertThatJson("""[{"foo": "bar baz"}]""").isArray
.first()
.node("foo")
.isEqualTo(value("bar baz")) or assertThatJson("""[{"foo": "bar baz"}]""").isArray
.first()
.isObject
.contains(entry("foo", "bar baz") But at the moment only P.S. btw thanks for your attention, it's really cool that you are so involved in this library |
Hi, you are right. There is actually a simplerm more correct solution. Should be available in 2.31.0. |
Describe the bug
This doesn't work:
But this does:
The above examples represent the same logic, and I expect them to work in the same way. It's a bit disappointing that a more readable one doesn't work
The text was updated successfully, but these errors were encountered: