阅读818 返回首页    go 阿里云 go 技术社区[云栖]


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

https://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);
	}

}




最后更新:2017-04-02 17:28:38

  上一篇:go Android资源预加载与AssetManager的使用
  下一篇:go 第四章:良好的坏习惯