您的位置:首页 > 产品设计 > UI/UE

JUNIT在线API以及 assertTrue(boolean condition),assertTrue(String message, boolean condition)

2012-05-14 14:23 375 查看
http://kentbeck.github.com/junit/javadoc/latest/

补充:

static void
assertTrue(String message,
boolean condition)


Asserts that a condition is true.
可以提示错误:

代码如下:

package com.zzk.junit4.test;

import static org.junit.Assert.*;//这是一个类不是包

import org.junit.After;
import org.junit.Test;

import com.zzk.junit4.T;

public class TTest {

@After
public void tearDown() throws Exception {
}

@Test
public void testAdd() {
//fail("Not yet implemented");
int z = new T().add(5, 3);
assertEquals(8, z);//期望值8,实际值z
assertTrue(z>3);
//   assertTrue("z is too small",z>10);
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: