Junit4测试:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock-junit4</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.2.1</version>
</dependency>
package cn.javass;
import org.junit.Assert;
import org.junit.Test;
public class TestDivide1 {
@Test
public void test1(){
Divide divide = new Divide();
final int expected = 3;
final int actual = divide.devide(7, 2);
Assert.assertEquals(expected, actual);
}
}
运行测试类:
测试结果:
第三次作业
原文:http://www.cnblogs.com/cuiguoang/p/5860314.html