Junit4 Sample

package com.lin.MavenTest;

import static java.lang.System.out;
import static org.junit.Assert.*;

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

/**
 * JUnit 4 uses org.junit.*
 */
public class Junit4Test {

	@Test
	public void test1() {
		out.println("test1");
		assertEquals("1", "1");
	}

	@Test
	public void test2() {
		out.println("test2");

	}

	@Ignore
	@Test
	public void test3() {
		out.println("test2");
	}

	@Before
	public void appBefore() {
		out.println("appBefore");
	}

	@After
	public void appAfter() {
		out.println("appAfter");
	}

	@BeforeClass
	static public void appBeforeClass() {
		out.println("appBeforeClass");
	}

	@AfterClass
	static public void appAfterClass() {
		out.println("appAfterClass");
	}

}

 

你可能感兴趣的:(JUnit4)