|
@@ -10,10 +10,10 @@ import com.dragonsoft.smtools.loader.SMFactory;
|
|
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.github.dreamhead.moco.HttpServer;
|
|
|
-import com.github.dreamhead.moco.Runner;
|
|
|
-import org.junit.AfterClass;
|
|
|
+import com.github.dreamhead.moco.junit.MocoJunitRunner;
|
|
|
import org.junit.Assert;
|
|
|
-import org.junit.BeforeClass;
|
|
|
+import org.junit.Before;
|
|
|
+import org.junit.Rule;
|
|
|
import org.junit.Test;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
@@ -33,15 +33,9 @@ import static com.github.dreamhead.moco.Moco.*;
|
|
|
public class BimBusinessImplTest {
|
|
|
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- try {
|
|
|
- BimBusinessImplTest.before();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static Runner runner;
|
|
|
+ HttpServer httpServer = httpServer(19000, log());
|
|
|
+ @Rule
|
|
|
+ public MocoJunitRunner mocoJunitRunner = MocoJunitRunner.httpRunner(httpServer);
|
|
|
|
|
|
|
|
|
static String identityUrl = "http://127.0.0.1:19000";
|
|
@@ -50,9 +44,8 @@ public class BimBusinessImplTest {
|
|
|
|
|
|
static BimBusinessImpl bimBusiness;
|
|
|
|
|
|
- @BeforeClass
|
|
|
- public static void before() throws Exception {
|
|
|
- HttpServer httpServer = httpServer(19000, log());
|
|
|
+ @Before
|
|
|
+ public void before() throws Exception {
|
|
|
|
|
|
httpServer.request(by(uri(appInfoUrl)))
|
|
|
.response(pathResource("bim/getAppTokenInfo.json"));
|
|
@@ -61,11 +54,6 @@ public class BimBusinessImplTest {
|
|
|
httpServer.request(by(uri(userInfoUrl)))
|
|
|
.response(pathResource("bim/getUserTokenInfo.json"));
|
|
|
|
|
|
-
|
|
|
- runner = Runner.runner(httpServer);
|
|
|
-
|
|
|
- runner.start();
|
|
|
-
|
|
|
SkipSslVerificationHttpRequestFactory skipSslVerificationHttpRequestFactory
|
|
|
= new SkipSslVerificationHttpRequestFactory();
|
|
|
skipSslVerificationHttpRequestFactory.setReadTimeout(5000);
|
|
@@ -87,10 +75,6 @@ public class BimBusinessImplTest {
|
|
|
bimBusiness.setSmFactory(smFactory);
|
|
|
}
|
|
|
|
|
|
- @AfterClass
|
|
|
- public static void stop() {
|
|
|
- runner.stop();
|
|
|
- }
|
|
|
|
|
|
@Test
|
|
|
public void getUserTokenInfo() {
|