assertj / assertj/assertj-assertions-generator-maven-plugin

Plugin randomly generates classes that don't compile

Open
#60 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
30
Forks
27
PR merge metrics
No merged PRs in 30d

Description

In some specific case the assertions generated by the plugin do not compile. This seems to happen randomly - I've prepared a simple example module ([assertj-generator-bug.zip](https://github.com/joel-costigliola/assertj-assertions-generator-maven-plugin/files/3295931/assertj-generator-bug.zip)) that on my machine fails about 50% of the time.

```
$ unzip assertj-generator-bug.zip
$ cd assertj-generator-bug
$ mvn clean install

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.exampl:assertj-generator-bug >------------------
[INFO] Building assertj-generator-bug 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ assertj-generator-bug ---
[INFO] Deleting /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ assertj-generator-bug ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ assertj-generator-bug ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 2 source files to /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/classes
[INFO]
[INFO] --- assertj-assertions-generator-maven-plugin:2.2.0:generate-assertions (default) @ assertj-generator-bug ---
[INFO] JUnit not found in project classpath => JUnitSoftAssertions entry point class won't be generated.
[INFO]

====================================
AssertJ assertions generation report
====================================

--- Generator input parameters ---

Generating AssertJ assertions for classes:
- com.example.SomeService

--- Generator results ---

Directory where custom assertions files have been generated:
- /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions

Custom assertions files generated:
- /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java

Assertions entry point class has been generated in file:
- /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/Assertions.java

SoftAssertions entry point class has been generated in file:
- /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SoftAssertions.java

[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ assertj-generator-bug ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/USERS/mpiela/devel/tmp/assertj-generator-bug/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ assertj-generator-bug ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 3 source files to /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[37,38] cannot find symbol
symbol: class E
location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[57,69] cannot find symbol
symbol: class E
location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[80,42] cannot find symbol
symbol: class E
location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[100,73] cannot find symbol
symbol: class E
location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[124,46] cannot find symbol
symbol: class E
location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[145,77] cannot find symbol
symbol: class E
location: class com.example.SomeServiceAssert
[INFO] 6 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.157 s
[INFO] Finished at: 2019-06-17T11:55:59+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile (default-testCompile) on project assertj-generator-bug: Compilation failure: Compilation failure:
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[37,38] cannot find symbol
[ERROR] symbol: class E
[ERROR] location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[57,69] cannot find symbol
[ERROR] symbol: class E
[ERROR] location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[80,42] cannot find symbol
[ERROR] symbol: class E
[ERROR] location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[100,73] cannot find symbol
[ERROR] symbol: class E
[ERROR] location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[124,46] cannot find symbol
[ERROR] symbol: class E
[ERROR] location: class com.example.SomeServiceAssert
[ERROR] /home/USERS/mpiela/devel/tmp/assertj-generator-bug/target/generated-test-sources/assertj-assertions/com/example/SomeServiceAssert.java:[145,77] cannot find symbol
[ERROR] symbol: class E
[ERROR] location: class com.example.SomeServiceAssert
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.