ºìÁªLinuxÃÅ»§
Linux°ïÖú

JUnit 4.11·¢²¼£¬Javaµ¥Ôª²âÊÔ¿ò¼Ü

·¢²¼Ê±¼ä:2012-11-16 11:06:05À´Ô´:ºìÁª×÷Õß:empast
JUnit 4.11 ·¢²¼£¬¸Ã°æ±¾Éý¼¶ Hamcrest µ½ 1.3 °æ±¾£¬¸Ä½øÁË assertThat £¬ÀýÈ磺

assertThat(Long.valueOf(1), instanceOf(Integer.class));

Ô­À´µÄ±¨´íÐÅÏ¢ÊÇ£º

Expected: an instance of java.lang.Integer
got: <1L>

еı¨´íÐÅÏ¢£º

Expected: an instance of java.lang.Integer
but: <1L> is a java.lang.Long

ÁíÍâµÄ¸Ä½øÄÚÈÝ»¹°üÀ¨²ÎÊý»¯²âÊÔ¡¢²âÊÔÖ´ÐеÄ˳Ðò¡¢Maven¡¢¹æÔòµÈ·½Ã棬ÏêÇéÇë¿´ÕâÀï¡£

Ö÷Ò³£ºhttp://www.junit.org/

ÏÂÔØ£ºhttps://github.com/KentBeck/junit

À´×Ô:¿ªÔ´ÖйúÉçÇø
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ