Skip to content

Support *easy* custom Representation for Duration objects in assertion messages #3976

@erizzo-cfa

Description

@erizzo-cfa

Feature summary

When using assertions on Durations, the actual and expected values are not always formatted in a user-friendly way. For example:

Expecting actual:
  0.002512594S
to be less than or equal to:
  0.001S 

Thinking it would be nice to be able to provide my own format pattern for those values, I started digging and found withRepresentation(). I was encouraged that I could easily reach my goal 🙌 , until I saw that StandardRepresentation.toStringof(Duration) is private. ☹️ It's pretty much the only overload of toStringOf() that's not overridable, is there a particular reason?
Can it be made protected so it can be overridden like all the other overloads?

Metadata

Metadata

Labels

No labels
No labels
No fields configured for ✨ New Feature.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions