-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Combine @Table with another formatter? #122
Comments
I totally agree that this makes sense, I just haven't thought about that yet ;-). Especially, whether you want to have the POJO rendered by the |
I defer this to v0.9.1 |
Ok, after some iterations on this issue, I think it is usable now. It is now possible to combine the |
Looks really cool at a first glance when I check the commit. Is there a short documentation with example for this that I can distribute to my colleagues? |
There is no documentation yet (next on my list). However, it should be more or less straightforward. You have now different options to customize the table formatting. Using
|
Hi again,
I'm currently playing again with the @table annotation:
returns the result:
By default, all POJO fields are rendered (unless modified with includeFields/excludeFields). The usage of fields basically works fine for POJOs where I have full control of or where I can find fields fields that return a well-formatted value.
In my case, DateTime consists of the fields iMillis or iChronology which are both not very readable. Therefore, my idea is to be able to supply an additional formatter.
If this makes sense for you, there are IMHO two ways:
a) The simple approach which probably already works without too much effort results in a one row/column (depending on the formatting) table + a optional numbering row/column. This would (at least for me... currently :) ) meet my requirement as I then would define my method like this
and receive an output like
Another flavour of this idea is to not be able to invoke the toString() method of a POJO, although the formatter idea is more flexible and powerful.
b) The other approach provided a way of post-formatting more than one value. There are several ideas of doing this (Formatter has to return an array? Be able to supply more than one formatter?).
Perhaps this request also makes sense to be included in JGiven.
Best regards,
Niko
The text was updated successfully, but these errors were encountered: