package junit.test;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

public class AnDemo {
 //define a test method
 @Test
 public void add() {
  assertEquals(2, 2);
 }
 
 //init every test method
 @Before
 public void ttttdiv() {
  
 }
 
 //destory
 @After
 public void ttttdiv2() {
  
 }
 
 //init once must static
 @BeforeClass
 public static void setUpBeforeClass() {
  
 }
 
 //must static
 @AfterClass
 public static void teardownAfterClass() {
  
 }
 
 @Test(expected=ArithmeticException.class)
 public void ex() {
  
 }
 
 @Test(timeout=100)
 public void ex2() {
  
 }
 public static void main(String[] args) {
  System.out.println("Hello");
 }
}

相关文章:

  • 2021-10-19
  • 2021-12-29
  • 2021-05-28
  • 2021-10-11
  • 2022-02-01
  • 2022-01-23
  • 2022-01-01
  • 2021-12-11
猜你喜欢
  • 2021-11-07
  • 2022-01-26
  • 2022-01-11
  • 2021-09-19
  • 2021-07-27
相关资源
相似解决方案