Calculate.java 代码 package com.ab.util; public class Calculate { public int add(int a, int b){ return a+b; } public int substract(int a, int b){ return a-b; } public int multiply(int a ,int b){ return a*b; } public ... Calculate.java 代码
package com.ab.util;
public class Calculate {
public int add(int a, int b){
return a+b;
}
public int substract(int a, int b){
return a-b;
}
public int multiply(int a ,int b){
return a*b;
}
public int divide( int a, int b){
return a/b;
}
}
CalculateTest.java 测试代码
package com.ab.util;
import static org.junit.Assert.*;
import org.junit.Test;
public class CalculateTest {
@Test
public void test() {
fail("Not yet implemented");
}
@Test
public void add(){
assertEquals(6, new Calculate().add(3, 3));
}
}