question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optionally generate AssertJ assertions for generated Immutable types

See original GitHub issue

It would be really cool, if at the same time as generating the immutable classes, custom assertions could be generated. AssertJ has an implementation which could be run from the annotation processor. This would mean clean tests when using in the same project or downstream.

Not sure how it would work. Maybe the processor could detect the presence of an assertion generator (AssertJ/Google Truth etc) and then generate.

There could be a an assertion flag on @Style? or a new annotation?

Many ways to do it.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
asereda-gscommented, Sep 21, 2019

Can you show some example of assertions you want to be executed ? Why do they have to be run from annotation processor ?

0reactions
cal101commented, Jan 31, 2020

Thanks for the pointer to the evaluator. It should indeed be possible to enhance that for assertJ like expressive messages.

From what I remember from the assertj inner workings it’s more comparable to the let’s say builder code generated by immutables. There is no “runtime system” or “evaluator” that can be “programmed”. It’s static code that allows writing fluent assertions and the error reporting is baked in.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AssertJ Assertions Generator
Use the Assertion Generator to create assertions specific to your own classes, either through a simple command line tool, a maven plugin or...
Read more >
Java static code analysis: Chained AssertJ assertions should ...
Chained AssertJ assertions should be simplified to the corresponding dedicated assertion ... AssertJ contains many assertions methods specific to common types.
Read more >
Write BDD Unit Tests with BDDMockito and AssertJ
Vanilla AssertJ uses the method Assertions.assertThat(actual) (abbreviated as assertThat(actual) to create the assertion type using the static ...
Read more >
Generated assertions do not preserve generic types · Issue #92
For example, if I have: public final Optional foo;, the generated ... Nava2 added a commit to Nava2/assertj-assertions-generator that ...
Read more >
Testing - Spring
For example, a mock request is immutable once created, ... uses the SpringExtension for JUnit Jupiter and AssertJ to assert the types of ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found