Giter VIP home page Giter VIP logo

Comments (3)

bedla avatar bedla commented on June 25, 2024 1

This is very interesting class loader problem, so I have investigated it more deeply and created repo to reproduce https://github.com/bedla/maven-assertj-generator-test-error

There are two workarounds described.

First to add JUnit4 to plugin dependencies:

            <plugin>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-assertions-generator-maven-plugin</artifactId>
                <version>2.2.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate-assertions</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <generateJUnitSoftAssertions>true</generateJUnitSoftAssertions>
                    <packages>
                        <param>cz.bedla.dto</param>
                    </packages>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>4.12</version>
                    </dependency>
                </dependencies>
            </plugin>

And second to disable JUnit soft assertion generation:

            <plugin>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-assertions-generator-maven-plugin</artifactId>
                <version>2.2.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate-assertions</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <generateJUnitSoftAssertions>false</generateJUnitSoftAssertions>
                    <packages>
                        <param>cz.bedla.dto</param>
                    </packages>
                </configuration>
            </plugin>

from assertj-assertions-generator-maven-plugin.

shaundsmith avatar shaundsmith commented on June 25, 2024

We've hit the same problem with assertj-assertions-generator-maven-plugin:2.2.0.

We found that a mvn clean test causes the assertions to be created correctly, but any subsequent mvn test will fail with the above issue.

We're using JDK11/Maven 3.6.0/JUnit 5 in our tech stack.
A workaround for our particular case is to add an explicit dependency on JUnit 4 in the plugin's declaration:

<plugin>
    <groupId>org.assertj</groupId>
    <artifactId>assertj-assertions-generator-maven-plugin</artifactId>
    <version>2.2.0</version>
    <executions>
        <execution>
            <goals>
                <goal>generate-assertions</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        ....
    </configuration>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13</version>
        </dependency>
    </dependencies>
</plugin>

from assertj-assertions-generator-maven-plugin.

pkrajanand avatar pkrajanand commented on June 25, 2024

I run into the same error when running mvn -Dit.test='testClassName.testMethodNameWithSpaces' verify.

My running environment is

Picked up _JAVA_OPTIONS: -Duser.home=/home
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/share/maven
Java version: 1.8.0_252, vendor: Azul Systems, Inc., runtime: /usr/lib/jvm/zulu-8-amd64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.19.76-linuxkit", arch: "amd64", family: "unix"

Any suggestions?

Of course, I didn't get the same when I run the whole test suite through mvn clean install

from assertj-assertions-generator-maven-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.