import org.junit.After; import org.junit.Before; import org.junit.Test; import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; public class CalculatorTest { @Before public void setUp() throws Exception { System.out.println("测试开始"); } @After public void tearDown() throws Exception { } @Test public void add() { Calculator cal = new Calculator(); cal.add(5); } @Test public void substract() { /**数值匹配**/ //测试变量是否大于指定值 assertThat(501,greaterThan(50)); //测试变量是否小于指定值 assertThat(6,lessThan(100)); } @Test public void a() { } @Test public void divide() { } @Test public void square() { } @Test public void squareRoot() { } @Test public void clear() { } @Test public void getResult() { } }