简体   繁体   English

java.lang.NoSuchFieldError:运行JUnit测试时的EDGE

[英]java.lang.NoSuchFieldError: EDGE when running JUnit test

Error when running JUnit test on IntelliJ 在IntelliJ上运行JUnit测试时出错

java.lang.NoSuchFieldError: EDGE

    at com.google.gwt.junit.RunStyleHtmlUnit.<clinit>(RunStyleHtmlUnit.java:288)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.google.gwt.junit.JUnitShell.createRunStyle(JUnitShell.java:1190)
    at com.google.gwt.junit.JUnitShell.doStartup(JUnitShell.java:917)
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:982)
    at com.google.gwt.junit.JUnitShell.getUnitTestShell(JUnitShell.java:673)
    at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:647)
    at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:421)
    at junit.framework.TestCase.runBare(TestCase.java:130)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:120)
    at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:247)
    at junit.framework.TestSuite.runTest(TestSuite.java:230)
    at junit.framework.TestSuite.run(TestSuite.java:225)
    at junit.textui.TestRunner.doRun(TestRunner.java:121)
    at com.intellij.junit3.JUnit3IdeaTestRunner.doRun(JUnit3IdeaTestRunner.java:113)
    at junit.textui.TestRunner.doRun(TestRunner.java:114)
    at com.intellij.junit3.JUnit3IdeaTestRunner.startRunnerWithArgs(JUnit3IdeaTestRunner.java:45)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

What could be the fix for this? 有什么解决办法?

As mentioned in other channels, this is likely due to your use of a non-standard gwt fork which does not implicitly bundle htmlunit anymore. 如其他渠道所述,这可能是由于您使用了非标准的gwt分支,该分支不再隐式捆绑htmlunit了。

Just add: 只需添加:

        <dependency>
            <groupId>net.sourceforge.htmlunit</groupId>
            <artifactId>htmlunit</artifactId>
            <version>2.19</version>
        </dependency>

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

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