ºÇ½ª¹¹¿·¡§ numeric96key 2013ǯ12·î16Æü(·î) 03:52:17ÍúÎò
package org.sample.junit; import static org.junit.Assert.*; import static org.hamcrest.CoreMatchers.*; import org.junit.Test; public class SampleAssertionTest { @Test public void test1() { assertThat(1, is(1)); assertThat("boolean check", true, is(true)); assertThat(1, not(2)); assertThat(1, is(not(2))); assertThat(null, nullValue()); assertThat(null, is(nullValue())); assertThat(1, notNullValue()); assertThat(1, is(notNullValue())); assertThat(new Integer(1), instanceOf(Integer.class)); Integer v = new Integer(2); assertThat(v, sameInstance(v)); assertThat(v, is(sameInstance(v))); } }
- ¥«¥Æ¥´¥ê¡§
- ³ØÌ䡦Íý·Ï
- Áí¹ç
¥¿¥°
¥³¥á¥ó¥È¤ò¤«¤¯