Generating logical equivalence assertions

Open
#184 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
testing, tooling

Research direction

Start by tracing the assertion generator plugin and the generated single-property assertion methods; no specific files or tests are named in the issue. Define the generated chained method's interface and decide how nested generated assertion classes would be reused, then verify the generated output and its error messages against an interface with multiple properties.

Written by the indexing model from the issue text.

Description

In our project, we have a module which defines an API - it's essentially a bunch of interfaces which are meant to be implemented elsewhere, possibly multiple times. We use the assertion generator plugin to generate asserts for these, which works great, but it becomes tedious if you want to assert multiple properties. We don't want to use the recursive comparator since this uses fields, not the properties as defined by the interfaces.

Is it possible to have the generator also generate a method which essentially chains all the generated single property asserts against an actual object of the same interface type? I feel like that should be possible, but maybe I'm missing something. That way you get the nice error messages from the single assertions without having to manually type all of this.

(bonus points if it can do it recursively (i.e. a nested interface which also has a generated assertion class for it would be reused), but I get that that would increase the complexity, and it's something we can easily glue ourselves)

Dominant language
Java
Stars
72
Forks
47
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from assertj/assertj-generator

All issues in assertj/assertj-generator

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.