package com.lovecoding.day13.throw01;

import org.junit.Test;

public class TestPerson {

    @Test
    public void fun1(){
        try {
            //抛出异常
            Person person = new Person("坤坤",-1);
        } catch (AgeException e) {
            e.printStackTrace();
            System.out.println("年龄不合法");
        }

        System.out.println("继续执行");

    }

    @Test
    public void fun2() throws AgeException {
       Person person = new Person();
       person.setAge(-1);
    }
}
