Using generateAssertionsInPackage in Maven results in compilation issues
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- build-system, tooling
Research direction
Reproduce the issue with the Maven generate-assertions goal and the generateAssertionsInPackage setting using the Holder and MyCustomClass example. Trace how imports are produced for generated assertion classes, then verify that the generated AbstractHolderAssert compiles when the referenced type is in another package.
Written by the indexing model from the issue text.
Description
Summary
Some classes for which I generate assertion classes contain methods with parameter types that are in the same package. If I then use <generateAssertionsInPackage> to generate the assertion classes in a different package, they miss the required imports for these types.
Example
public class Holder {
private Collection<? extends MyCustomClass> values;
}
<plugin>
<groupId>org.assertj</groupId>
<artifactId>assertj-assertions-generator-maven-plugin</artifactId>
<version>2.1.0</version>
<executions>
<execution>
<goals>
<goal>generate-assertions</goal>
</goals>
</execution>
</executions>
<configuration>
<generateAssertionsInPackage>assertj.generated.assertions</generateAssertionsInPackage>
</configuration>
</plugin>
Results in the following assertion class:
public class HolderAssert extends AbstractHolderAssert<HolderAssert, Holder> {
(..)
}
import org.assertj.core.api.AbstractObjectAssert;
import org.assertj.core.internal.Iterables;
import org.assertj.core.util.Objects;
public abstract class AbstractHolderAssert<S extends AbstractHolderAssert<S, A>, A extends Holder> extends AbstractObjectAssert<S, A> {
(..)
// class MyCustomClass not imported == compilation error -->
public S hasValues(MyCustomClass... values) {
(..)
}
}
- 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 5/5 Over a week Newbie friendliness 35/100
assertj/assertj-generator#204 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
assertj/assertj-generator#197 · 7 comments ·
All issues in assertj/assertj-generator
Similar issues
-
area/plugin
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
kestra-io/plugin-kestra#190 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/rocketmq-dashboard#5064 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
wso2/dpdp-accelerator#287 ·