-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathLocalUnitTest.java
More file actions
35 lines (27 loc) · 861 Bytes
/
Copy pathLocalUnitTest.java
File metadata and controls
35 lines (27 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.example.testing.testingexample;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
/**
* author: baiiu
* date: on 16/4/27 14:15
* description: Java单元测试类.Local Unit Test,对frameword毫无依赖
*/
public class LocalUnitTest {
private Calculator calculator;
@Before public void setUp() throws Exception {
calculator = new Calculator();
}
@Test public void testSum() throws Exception {
Assert.assertEquals(6D, calculator.sum(1D, 5D));
}
@Test public void testSubtract() throws Exception {
Assert.assertEquals(1D, calculator.subtract(3D, 2D));
}
@Test public void testDivide() throws Exception {
Assert.assertEquals(5D, calculator.divide(10D, 2D));
}
@Test public void testMultiply() throws Exception {
Assert.assertEquals(6D, calculator.multiply(2D, 3D));
}
}