FQCN of assertion classes are not replaced in assertions entry point classes when using the generateAssertionsInPackage option.

Open
#122 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
tooling

Research direction

Start with pom.xml and compare the generated FooAssert.java with the Assertions.java entry point when generateAssertionsInPackage is set to sample.assertion. Trace the generator path that writes the entry point and ensure its assertion class reference uses the generated package; done means the entry point returns sample.assertion.FooAssert and constructs that class.

Written by the indexing model from the issue text.

Description

I use generateAssertionsInPackage option like following.

Project structure

|-src/main/java
|  `-sample/
|    `-Foo.java
`-pom.xml

pom.xml

<configuration>
  <packages>
    <param>sample</param>
  </packages>
  <generateAssertionsInPackage>sample.assertion</generateAssertionsInPackage>
</configuration>

Assertion class is generated as sample.assertion.FooAssert.

FooAssert.java

package sample.assertion;

import sample.Foo;

...

public class FooAssert extends AbstractFooAssert<FooAssert, Foo> {

However assertions entry point classes are generated like following.

Assertions.java

package sample.assertion;

...
@javax.annotation.Generated(value="assertj-assertions-generator")
public class Assertions {

  ...
  @org.assertj.core.util.CheckReturnValue
  public static sample.FooAssert assertThat(sample.Foo actual) {
    return new sample.FooAssert(actual);
  }

FooAssert is written as sample.FooAssert (not sample.assertion.FooAssert).

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.