Alex Foglia
Alex Foglia

Reputation: 530

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?

Upvotes: 1

Views: 183

Answers (1)

Alex Foglia
Alex Foglia

Reputation: 530

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" });

Upvotes: 2

Related Questions