How to use the Junit test

package com.sxt;

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

public class JunitDemo {
	@Before // run before the test
	public void doBefore() {   
		System.out.println("Before the test");
	}
	
	@Test //junit test annotation
	public void test() { //Click on the method name, then run, only test this one
		System.out.println("Test 1");
	}
	@Test
	public void test2() {
		System.out.println("Test 2");
	}
	@After // run after the test
	public void doAfter() {
		System.out.println("After the test");
	}
	
	}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324824031&siteId=291194637