assertj-assertions-generator
assertj-assertions-generator copied to clipboard
Using generateAssertionsInPackage in Maven results in compilation issues
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) {
(..)
}
}
Thanks for reporting this! I don't have much time these days unfortunately but I can review a PR if someone is keen to tackle that issue.
This actually belong to https://github.com/joel-costigliola/assertj-assertions-generator