java.lang.NoClassDefFoundError: org/junit/internal/AssumptionViolatedException
2016-07-04 19:23
543 查看
1、错误描述
2、错误原因
3、解决办法
下载hamcrest-core-1.1.jar拷贝到lib目录
或者
在pom.xml添加
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. java.lang.NoClassDefFoundError: org/junit/internal/AssumptionViolatedException at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
2、错误原因
/* */ package org.junit.internal; /* */ /* */ import org.hamcrest.Description; /* */ import org.hamcrest.Matcher; /* */ import org.hamcrest.SelfDescribing; /* */ import org.hamcrest.StringDescription; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class AssumptionViolatedException /* */ extends RuntimeException /* */ implements SelfDescribing /* */ { /* */ private static final long serialVersionUID = 2L; /* */ private final String fAssumption; /* */ private final boolean fValueMatcher; /* */ private final Object fValue; /* */ private final Matcher<?> fMatcher; /* */ /* */ @Deprecated /* */ public AssumptionViolatedException(String assumption, boolean hasValue, Object value, Matcher<?> matcher) /* */ { /* 33 */ this.fAssumption = assumption; /* 34 */ this.fValue = value; /* 35 */ this.fMatcher = matcher; /* 36 */ this.fValueMatcher = hasValue; /* */ /* 38 */ if ((value instanceof Throwable)) { /* 39 */ initCause((Throwable)value); /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public AssumptionViolatedException(Object value, Matcher<?> matcher) /* */ { /* 51 */ this(null, true, value, matcher); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public AssumptionViolatedException(String assumption, Object value, Matcher<?> matcher) /* */ { /* 62 */ this(assumption, true, value, matcher); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public AssumptionViolatedException(String assumption) /* */ { /* 72 */ this(assumption, false, null, null); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ @Deprecated /* */ public AssumptionViolatedException(String assumption, Throwable e) /* */ { /* 82 */ this(assumption, false, null, null); /* 83 */ initCause(e); /* */ } /* */ /* */ public String getMessage() /* */ { /* 88 */ return StringDescription.asString(this); /* */ } /* */ /* */ public void describeTo(Description description) { /* 92 */ if (this.fAssumption != null) { /* 93 */ description.appendText(this.fAssumption); /* */ } /* */ /* 96 */ if (this.fValueMatcher) /* */ { /* 98 */ if (this.fAssumption != null) { /* 99 */ description.appendText(": "); /* */ } /* */ /* 102 */ description.appendText("got: "); /* 103 */ description.appendValue(this.fValue); /* */ /* 105 */ if (this.fMatcher != null) { /* 106 */ description.appendText(", expected: "); /* 107 */ description.appendDescriptionOf(this.fMatcher); /* */ } /* */ } /* */ } /* */ } /* Location: C:\Users\Administrator\Desktop\junit-4.12.jar * Qualified Name: org.junit.internal.AssumptionViolatedException * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.0.1 */AssumptionViolatedException这个异常是实现SelfDescribing,但是SelfDescribing来自org.hamcrest.SelfDescribing
3、解决办法
下载hamcrest-core-1.1.jar拷贝到lib目录
或者
在pom.xml添加
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core --> <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-core</artifactId> <version>1.1</version> </dependency>
相关文章推荐
- java.lang.NoClassDefFoundError: org/junit/rules/TestRule
- Error:java: Compilation failed: internal java compiler error
- Java实现几种常见排序方法
- Jetty配置
- JAVA 十六进制与字符串的转换
- maven打可运行的jar包
- java:NIO读写文件的示例
- 第一章:Java多线程技能
- 尚学堂 JAVA Day3 概念总结
- 华为机试--Java
- Spring配置文件总结
- SpringMVC 使用JSR-303进行校验 @Valid
- 一行代码实现java list去重
- JAVA自学之每日一题(五)
- Kafka源码调试环境搭建
- Spring自动装配
- Spring结合三层架构
- 用文件上传了解struts2拦截器的使用
- Java中的instanceof关键字
- Java单例模式(Singleton)