Commit 2243da9f authored by nobodyiam's avatar nobodyiam

fix legacy mock issue

parent 50f0e6eb
......@@ -7,6 +7,7 @@ import com.ctrip.framework.apollo.biz.service.AppService;
import com.ctrip.framework.apollo.common.dto.AppDTO;
import com.ctrip.framework.apollo.common.entity.App;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
......@@ -31,6 +32,8 @@ public class ControllerIntegrationExceptionTest extends AbstractControllerTest {
@Mock
AdminService adminService;
private Object realAdminService;
@Autowired
AppService appService;
......@@ -39,9 +42,17 @@ public class ControllerIntegrationExceptionTest extends AbstractControllerTest {
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
realAdminService = ReflectionTestUtils.getField(appController, "adminService");
ReflectionTestUtils.setField(appController, "adminService", adminService);
}
@After
public void tearDown() throws Exception {
ReflectionTestUtils.setField(appController, "adminService", realAdminService);
}
private String getBaseAppUrl() {
return "http://localhost:" + port + "/apps/";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment