点击(此处)折叠或打开
- package com.bird.junit;
- import junit.framework.Assert;
- import org.junit.After;
- import org.junit.Before;
- import org.junit.Test;
- public class TestPerson {
- private Person p;
- @Before
- public void before(){
- p=new Person();
- System.out.println("Before");
- }
- @Test
- public void testRun(){
- //断言
- Assert.assertEquals("2",p.run());
- }
- @Test
- public void testEat(){
- //断言
- p.eat();
- }
-
- @After
- public void after(){
- p=null;
- System.out.println("After");
- }
- }