 |
|
|
MathTest.java
|
import static org.junit.Assert.assertEquals;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
public class MathTest {
@BeforeClass
public static void oneTimeSetUp() {
System.out.println("Run once before all the tests");
}
@AfterClass
public static void oneTimeTearDown() {
System.out.println("Run once after all the tests");
}
@Before
public void setUp() {
System.out.println("Run once before each test");
}
@After
public void tearDown() {
System.out.println("Run once after each test");
}
@Test
public void testMax() {
int a = 3;
int b = 4;
int out = Math.max(a, b);
assertEquals(b, out);
}
@Test
public void testMin() {
int a = 3;
int b = 4;
int out = Math.min(a, b);
assertEquals(a, out);
}
}
|
|
|
 |