📄 assumptionviolatedexceptiontest.java
字号:
package org.junit.tests;import static org.junit.matchers.StringContains.containsString;import static org.hamcrest.CoreMatchers.is;import static org.junit.Assert.assertThat;import org.hamcrest.Matcher;import org.hamcrest.StringDescription;import org.junit.Test;import org.junit.Assume.AssumptionViolatedException;import org.junit.experimental.theories.Theories;import org.junit.experimental.theories.Theory;import org.junit.runner.RunWith;@RunWith(Theories.class)public class AssumptionViolatedExceptionTest { public static Object TWO= 2; public static Matcher<?> IS_THREE= is(3); @Theory public void toStringIsUseful(Object actual, Matcher<?> matcher) { assertThat(new AssumptionViolatedException(actual, matcher).toString(), containsString(matcher.toString())); } @Test public void AssumptionViolatedExceptionDescribesItself() { AssumptionViolatedException e= new AssumptionViolatedException(3, is(2)); assertThat(StringDescription.asString(e), is("got: <3>, expected: is <2>")); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -