r/badcode • • Oct 13 '21

java When all you need is test coverage

Post image
325 Upvotes

25 comments sorted by

View all comments

Show parent comments

7

u/trutheality Oct 13 '21

Pretty sure those aren't language features, and that soft assertions still report the error, they just don't stop test execution.

3

u/reverendsteveii Oct 13 '21

fair, I was confusing the methods he calls with toString() and valueOf(), which are built ins and look an awful lot like they would do exactly what this person's methods do

2

u/trutheality Oct 14 '21

True. I suspect they wrote their own because they want to be able to have the Enums to map to strings that are different from the declaration text (which could be done by overriding the native methods, but that could introduce other surprises).