Hey. looking at the errors, i thouht.... instead ...
# strikt
a
Hey. looking at the errors, i thouht.... instead of show this:
Copy code
com.infojobs.app.base.datasource.cachedb.DateConverterTest > should convert Instant objects FAILED
    org.opentest4j.AssertionFailedError: ▼ Expect that 2021-02-24T14:04:22.023Z:
      ✗ is equal to 2021-02-24T14:04:22.023564Z
              found 2021-02-24T14:04:22.023Z
Wouldn't be better to show like this:
Copy code
com.infojobs.app.base.datasource.cachedb.DateConverterTest > should convert Instant objects FAILED
    org.opentest4j.AssertionFailedError:
    ▼ Expect that 2021-02-24T14:04:22.023Z:
      ✗ is equal to 2021-02-24T14:04:22.023564Z
              found 2021-02-24T14:04:22.023Z
????
I mean, move the first assertion line to the below line, to improve readability
r
yeah, that probably would be better. Good point
c
in failfast i just show it without the “org.opentest4j.AssertionFailedError:” part because its pretty clear that its an assertion failure
but a solution that works with all test runners would be to subclass AssertionFailedError, wit h a nicer name (maybe `strikt.Failure`` )
👍 1
a
Or just add an
/n
to the start of strikt error
c
sure, but i mean that the exception name is long and a bit useless .)
in addition to your suggestion
a
Oh ok, cool
r
yeah, I think that’s a good plan. I was intending to remove the dependency on opentest4j anyway (as it blocks any possibility of Strikt multi-platform) so creating specific Strikt exception types would make sense
c
another thing that is a bit suprising is that the actual value is printed twice
a
oh, i thought it was intended
r
that’s really because of the
isEqualTo
being used. If you’re using another assertion, e.g.
hasLength
the assertion output wouldn’t include the actual value of the string, so it’s useful to have it in the “expect that…” part
c
isEqual should probably omit the “found” part. Its probably the most used assertion by far
a
hi... has this got merged and released?
r
not yet. Haven’t had a lot of free time recently
c
cool that the solution is so simple. I was going to override the exceptions with shorter names, but you can just override toString