package bull01.Unit;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class UnitDemo1 {
@Test
public void method1() {
System.out.println("this is method1");
}
@Test
public void method2() {
System.out.println("this is method2");
}
@Test
public void method3() {
System.out.println("this is method3");
}
@Before
public void myBefore() {
System.out.println("this is before");
}
@After
public void myAfter() {
System.out.println("this is after");
}
}
- JavaBean规范以及Java提供三种方式获得Class对象
package bull02.Reflect;
public class Bean implements java.io.Serializable {
private String name;
private int age;
public Bean() {
}
public Bean(String name,int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
package bull02.Reflect;
import org.junit.Test;
public class ClassDemo {
@Test
public void demo1() throws ClassNotFoundException {
Class clazz = Class.forName("bull02.Reflect.Bean");
System.out.println(clazz);
}
@Test
public void demo2() {
Class clazz = Bean.class;
System.out.println(clazz);
}
@Test
public void demo3() {
Bean be = new Bean();
Class clazz = be.getClass();
System.out.println(clazz);
}
}