Giter Site home page Giter Site logo

Comments (3)

joel-costigliola avatar joel-costigliola commented on June 26, 2024

I'm not too sure what we could improve here, satisfiesOnlyOnce(isFive) succeeds if exactly one element passes isFive. In the given example, it means three isFive assertions fail and one succeeds, it would not make sense to report any isFive failure since they could occur while satisfiesOnlyOnce(isFive) succeeds.

@upsidedownsmile what kind of improvement would you like to see in the error message ?
Could you show us on concrete examples ?

from assertj.

upsidedownsmile avatar upsidedownsmile commented on June 26, 2024

Thanks for the explanation @joel-costigliola, now I understand why the underlying assertion error is not in the stackstrace. I forgot that there are different permutations of failed assertions and that's hard to put in the error message.

But right now it is really hard to debug cases where there are several assertions inside a satisfiesOnlyOnce.

A realistic example:
assertSemanticConventionsSpanAttributes has an satisfiesOnlyOnce which will call assertSemanticConventionsAttributes.
In this case it's really hard to understand which assertion failed in assertSemanticConventionsAttributes because the stacktrace only shows line 147.

Is there anything that can be done to improve this?
Maybe we are writing tests the wrong away which causes these debug problem. Let me know if there is a better way to improve debuggability for these cases.

from assertj.

scordio avatar scordio commented on June 26, 2024

@upsidedownsmile I noticed the links in your message were broken, so I tried to restore them.

I tried to look at the test but I'm not sure I understand how you'd like to verify attributesList.

In case you have a list of requirements and want to make sure that there is exactly one element satisfying it without knowing its position in advance, satisfiesExactlyInAnyOrder might help.

from assertj.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.