- package com.bill99.junit;
-
-
- import java.lang.reflect.Method;
-
- import junit.framework.Assert;
-
- import org.junit.Before;
- import org.junit.Test;
-
- public class ACaseTest {
-
- ACase a =null;
-
- @Before
- public void setUp() throws Exception {
- a = new ACase();
- }
-
- @Test
- public void testNoParamEchoRequest() throws Exception {
-
- Method testNoParamMethod = a.getClass().getDeclaredMethod("echoRequest", null);
-
-
-
- testNoParamMethod.setAccessible(true);
-
- Object result = testNoParamMethod.invoke(a, null);
- System.out.println(result);
- Assert.assertNotNull(result);
-
- }
-
- @Test
- public void testParamEchoRequest() throws Exception {
-
- Method testNoParamMethod = a.getClass().getDeclaredMethod("echoRequest",String.class);
- testNoParamMethod.setAccessible(true);
-
- Object result = testNoParamMethod.invoke(a, "this is a test information");
- System.out.println(result);
- Assert.assertNotNull(result);
-
- }
-
- }
https://blog.csdn.net/iameyama/article/details/50411212html
IDEA配置junit:java
http://www.360doc.com/content/17/0701/11/10072361_667938060.shtml測試