简体   繁体   中英

AssertJ no such method error when building locally

I'm having an issue during local build of a multi-module project.

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.118 
sec <<< FAILURE! - in org.end2end.ClientEnd2EndIT
org.end2end.ClientEnd2EndIT  Time elapsed: 0.118 sec  <<< ERROR!
java.lang.NoSuchMethodError: 
org.assertj.core.util.Throwables.
              appendStackTraceInCurrentThreadToThrowable

Exactily when executing this instruction in setupClass method of the test:

frame = GuiActionRunner.execute(() -> GUI.createGui(false));

Where GuiActionRunner.execute() is a method of AssertJ dependency. In the same project I'm building the Client before the End2End module and this instruction is executed even in client's integration tests but in that case the NoSuchMethodError does not take place. I would specify that if I build under a macOS system or on Travis-ci (both linux and mac builds) this problem does not appears. This seems to be just a local problem (I'm using linux Mint 18.2). Can anyone help?

Solved. The problem was an hidden headless exception thrown while creating the jframe, and this was due to the fact that I was calling:

SpringApplicationBuilder builder = new 
SpringApplicationBuilder(ServerApplication.class);
builder.run(new String[] { "--server.port=9999" });

I solved by adding:

SpringApplicationBuilder builder = new SpringApplicationBuilder(ServerApplication.class);
    builder.headless(false); //this line
    builder.run(new String[] { "--server.port=9999" });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM