4、私有方法的测试
私有方法的参数带有包裹类型(Integer),基本类型(int)
package com.wdzwdz.test;
import junit.framework.Assert;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.j2speed.accessor.MethodAccessor;
import com.wdzwdz.AnObject;
/****
* test methord
* */
public class AnObjectTest2 {
private AnObject target;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
@Before
public void setUp() throws Exception {
target = new AnObject(10, "wdz1");
}
@Test
public void testanotherMethod() {
MethodAccessor m = new MethodAccessor("anotherMethod",
target, Integer.class, int.class, float.class);
String s = m.invoke(new Integer(1), 2, 1.1f);
System.err.println(s);
Assert.assertEquals("wdz1,2,1.1", s);
}
}
import junit.framework.Assert;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import com.j2speed.accessor.MethodAccessor;
import com.wdzwdz.AnObject;
/****
* test methord
* */
public class AnObjectTest2 {
private AnObject target;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
@Before
public void setUp() throws Exception {
target = new AnObject(10, "wdz1");
}
@Test
public void testanotherMethod() {
MethodAccessor m = new MethodAccessor("anotherMethod",
target, Integer.class, int.class, float.class);
String s = m.invoke(new Integer(1), 2, 1.1f);
System.err.println(s);
Assert.assertEquals("wdz1,2,1.1", s);
}
}