6
我想弄清楚org.mockito.AdditionalMatchers
如何工作,但我失敗了。爲什麼這個測試失敗?我該如何使用org.mockito.AdditionalMatchers.gt?
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
import static org.mockito.AdditionalMatchers.*;
public class DemoTest {
@Test
public void testGreaterThan() throws Exception {
assertThat(17
, is(gt(10))
);
}
}
輸出是:
java.lang.AssertionError:
Expected: is <0>
got: <17>