简体   繁体   English

在本地构建时AssertJ没有此类方法错误

[英]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: 正是在测试的setupClass方法中执行此指令时:

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

Where GuiActionRunner.execute() is a method of AssertJ dependency. 其中GuiActionRunner.execute()是AssertJ依赖项的方法。 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. 在同一项目中,我正在End2End模块之前构建Client,并且即使在客户端的集成测试中也要执行此指令,但在这种情况下不会发生NoSuchMethodError。 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. 我要指定的是,如果我在macOS系统下或Travis-ci(Linux和Mac构建)上进行构建,则不会出现此问题。 This seems to be just a local problem (I'm using linux Mint 18.2). 这似乎只是一个本地问题(我使用的是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: 问题是在创建jframe时抛出了一个无头的隐藏异常,这是由于我在调用以下事实:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Assertj-swagger 在执行测试时抛出 org.assertj.core.error.AssertJMultipleFailuresError 多次失败 - Assertj-swagger throws org.assertj.core.error.AssertJMultipleFailuresError Multiple Failures when executing test AssertJ:使用方法 assertThatThrownBy 时如何返回实际异常 - AssertJ: How to return the actual exception when using method assertThatThrownBy Assertj 3.16.1 中是否不推荐使用“hasOnlyElementsOfType”方法 - Is the method “hasOnlyElementsOfType” deprecated in Assertj 3.16.1 使用具有继承的 AssertJ usingComparatorForType 方法 - using AssertJ usingComparatorForType method with inheritance 在本地构建时自动重建依赖项目 - Rebuild dependent projects automatically when building locally 导入 AssertJ 和 JUnit 时的问题 - Problems when importing AssertJ and JUnit 构建Java Maven模块时出现方法required()错误 - method required() error when building java maven module 无法解析符号&#39;Assertions&#39;&lt;-尝试在IntelliJ中使用AssertJ时出现错误消息 - Cannot resolve symbol 'Assertions' <— Error message when trying to use AssertJ in IntelliJ 本地编译时出现PhoneGap错误 - PhoneGap error when compiling locally 当类字段是集合时,AssertJ usingRecursiveComparison 失败 - AssertJ usingRecursiveComparison fails when a class field is a collection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM