Skip to content

Commit

Permalink
测试启动优化
Browse files Browse the repository at this point in the history
  • Loading branch information
xenv committed Feb 12, 2019
1 parent fcea91d commit 4869e34
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/test/java/ma/luan/yiyan/api/ApiVerticleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.vertx.ext.web.client.WebClient;
import io.vertx.ext.web.client.WebClientOptions;
import ma.luan.yiyan.MainVerticle;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand All @@ -24,10 +24,10 @@

@RunWith(VertxUnitRunner.class)
public class ApiVerticleTest {
private WebClient webClient;
private static WebClient webClient;

@Before
public void beforeClass(TestContext context) {
@BeforeClass
public static void beforeClass(TestContext context) {
Async async = context.async();
Vertx vertx = Vertx.vertx();
JsonObject config = new JsonObject(vertx.
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/ma/luan/yiyan/service/DataServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import ma.luan.yiyan.constants.Key;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand All @@ -19,10 +19,10 @@

@RunWith(VertxUnitRunner.class)
public class DataServiceTest {
private Vertx vertx;
private static Vertx vertx;

@Before
public void beforeClass(TestContext context) {
@BeforeClass
public static void beforeClass(TestContext context) {
Async async = context.async();
vertx = Vertx.vertx();
JsonObject config = new JsonObject(vertx.
Expand Down
11 changes: 5 additions & 6 deletions src/test/java/ma/luan/yiyan/service/LogServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import ma.luan.yiyan.constants.Key;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand All @@ -17,14 +17,13 @@

@RunWith(VertxUnitRunner.class)
public class LogServiceTest {
private Vertx vertx;
private JsonObject config;
private static Vertx vertx;

@Before
public void beforeClass(TestContext context) {
@BeforeClass
public static void beforeClass(TestContext context) {
Async async = context.async();
vertx = Vertx.vertx();
config = new JsonObject(vertx.
JsonObject config = new JsonObject(vertx.
fileSystem().readFileBlocking("conf.json"));
vertx.deployVerticle(new LogService(), new DeploymentOptions().setConfig(config), c -> {
async.complete();
Expand Down

0 comments on commit 4869e34

Please sign in to comment.