You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to create a custom ResultWriter implementation to output assertion subjects as JSON strings (ideally, enriching the ouput with pointers to the failed properties). However, the current library architecture poses challenges for achieving this. While there are existing ResultWriter implementations like AnsiColorResultWriter and MarkdownResultWriter, they are not directly usable due to visibility and usage restrictions.
The problem lies in the fact that ResultWriter is internally defined within the AssertionStrategy class, but it's not part of its constructor. Additionally, AssertionStrategy is part of the AssertionBuilder class constructor, but that does not help since AssertionBuilder is also an internal class.
interface DescribeableBuilder
\
internal class AssertionBuilder(AssertionStrategy)
\
internal class AssertionStrategy
\
interface ResultWriter
This design makes it difficult to extend ResultWriter functionality without creating custom versions of both AssertionBuilder and AssertionStrategy, which is a substantial task.
I seek guidance on the best approach to tackle this issue. Specifically, I'm interested in contributing to make the ResultWriter customizable. This enhancement could benefit both my use case and the wider user community facing similar needs.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi!
I need to create a custom
ResultWriter
implementation to output assertion subjects as JSON strings (ideally, enriching the ouput with pointers to the failed properties). However, the current library architecture poses challenges for achieving this. While there are existingResultWriter
implementations likeAnsiColorResultWriter
andMarkdownResultWriter
, they are not directly usable due to visibility and usage restrictions.The problem lies in the fact that
ResultWriter
is internally defined within theAssertionStrategy class
, but it's not part of its constructor. Additionally,AssertionStrategy
is part of theAssertionBuilder class
constructor, but that does not help sinceAssertionBuilder
is also an internal class.This design makes it difficult to extend
ResultWriter
functionality without creating custom versions of bothAssertionBuilder
andAssertionStrategy
, which is a substantial task.I seek guidance on the best approach to tackle this issue. Specifically, I'm interested in contributing to make the
ResultWriter
customizable. This enhancement could benefit both my use case and the wider user community facing similar needs.Thank you for your assistance :)
Best regards,
Sergei
Beta Was this translation helpful? Give feedback.
All reactions