第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

在IntelliJ 10.5中運(yùn)行測(cè)試時(shí)得到“ NoSuchMethodError:

在IntelliJ 10.5中運(yùn)行測(cè)試時(shí)得到“ NoSuchMethodError:

慕碼人8056858 2019-12-20 10:33:55
我正在使用JUnit-dep 4.10和Hamcrest 1.3.RC2。我創(chuàng)建了一個(gè)自定義匹配器,如下所示:public static class MyMatcher extends TypeSafeMatcher<String> {    @Override    protected boolean matchesSafely(String s) {        /* implementation */    }    @Override    public void describeTo(Description description) {        /* implementation */    }    @Override    protected void describeMismatchSafely(String item, Description mismatchDescription) {        /* implementation */    }}當(dāng)使用Ant從命令行運(yùn)行時(shí),它工作得很好。但是,從IntelliJ運(yùn)行時(shí),它失敗并顯示:java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)V    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)    at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:8)    at com.netflix.build.MyTest.testmyStuff(MyTest.java:40)我的猜測(cè)是它使用了錯(cuò)誤的hamcrest.MatcherAssert。如何找到正在使用的hamcrest.MatcherAssert(即hamcrest.MatcherAssert使用的是哪個(gè)jar文件)?AFAICT,在我的類路徑中唯一的hamcrest jar是1.3.RC2。IntelliJ IDEA是否使用它自己的JUnit或Hamcrest副本?如何輸出IntelliJ使用的運(yùn)行時(shí)CLASSPATH?
查看完整描述

3 回答

?
守候你守候我

TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超10個(gè)贊

當(dāng)您已經(jīng)在類路徑上使用了mockito-all時(shí),也會(huì)出現(xiàn)此問(wèn)題。


如果可能的話,只需包括模仿主體。


用于混合junit,mockito和hamcrest的Maven配置:


<dependencies>

  <dependency>

    <groupId>org.hamcrest</groupId>

    <artifactId>hamcrest-core</artifactId>

    <version>1.3</version>

    <scope>test</scope>

  </dependency>

  <dependency>

    <groupId>org.hamcrest</groupId>

    <artifactId>hamcrest-library</artifactId>

    <version>1.3</version>

    <scope>test</scope>

  </dependency>

  <dependency>

    <groupId>org.mockito</groupId>

    <artifactId>mockito-all</artifactId>

    <version>1.9.5</version>

    <scope>test</scope>

  </dependency>

  <dependency>

    <groupId>junit</groupId>

    <artifactId>junit</artifactId>

    <version>4.11</version>

    <scope>test</scope>

  </dependency>

</dependencies>


查看完整回答
反對(duì) 回復(fù) 2019-12-20
?
哆啦的時(shí)光機(jī)

TA貢獻(xiàn)1779條經(jīng)驗(yàn) 獲得超6個(gè)贊

問(wèn)題是使用了錯(cuò)誤的類而hamcrest.Matcher不是hamcrest.MatcherAssert類。這是從junit-4.8依賴項(xiàng)中提取的,這是我的一個(gè)依賴項(xiàng)。


要查看在測(cè)試時(shí)從哪個(gè)來(lái)源包含了哪些依賴項(xiàng)(和版本),請(qǐng)運(yùn)行:


mvn dependency:tree -Dscope=test


查看完整回答
反對(duì) 回復(fù) 2019-12-20
  • 3 回答
  • 0 關(guān)注
  • 603 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)