Support special objectAssertion templates for specific property types
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by tracing how objectAssertion templates are selected and how property types are represented in the generator. Compare the requested BigDecimal-only example with the existing generated assertions; done means a type-specific template can generate hasHeightOf(Number) without generating that overload for unrelated property types, while preserving current behavior.
Written by the indexing model from the issue text.
Description
For example, I would like custom assertions for BigDecimal only like: has${Property}Of(Number value)
public ${self_type} has${Property}Of(Number n) ${throws}{
if (new BigDecimal(n.toString()).compareTo(actual.${property}) != 0) {
throw new AssertionError("expected " + n + " but got " + actual.${property});
}
}
So then I can do:
PersonAssert.hasHeightOf(5);
Instead of
PersonAssert.hasHeightOf(BigDecimal.valueOf(5));
And of course I wouldn't want it to also generate PersonAssert.hasNameOf(Number n);.
So it would be nice to be able to specify a template just for BigDecimal property types. And I assume that this could be generalized to any property type.
- Dominant language
- Java
- Stars
- 72
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from assertj/assertj-generator
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
assertj/assertj-generator#278 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
assertj/assertj-generator#220 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
assertj/assertj-generator#219 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
assertj/assertj-generator#197 · 7 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
assertj/assertj-generator#196 ·
All issues in assertj/assertj-generator
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100