TestForGit

 1 public class Colculter {
 2     public double sum(double a,double b){
 3         return a+b;
 4     }
 5     public double substract(double a,double b){
 6         return a-b;
 7     }
 8     public double divide(double a,double b){
 9         return a/b;
10     }
11     public double aulitply(double a,double b){
12         return a*b;
13     }
14 }
public class ColculterTest {
    private Colculter mColculter;
    @Before
    public void setUp() throws Exception {
        mColculter = new Colculter();

    }
    @After
    public void tearDown() throws Exception{

    }

    @Test
    public void sum() throws Exception {
        assertEquals(8d,mColculter.sum(3d,5d),0);

    }

    @Test
    public void substract() throws Exception {
        assertEquals(1d,mColculter.substract(5d,4d),0);

    }

    @Test
    public void divide() throws Exception {
        assertEquals(4d,mColculter.divide(20d,5d),0);

    }

原文地址:https://www.cnblogs.com/u1118733/p/6563711.html