Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.servicecomb.metrics.core.publish.model.DefaultPublishModel;
import org.apache.servicecomb.swagger.invocation.InvocationType;
import org.apache.servicecomb.swagger.invocation.Response;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.core.env.Environment;
Expand All @@ -41,6 +40,8 @@
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import io.vertx.core.json.Json;

import org.skyscreamer.jsonassert.JSONAssert;

public class TestInvocationPublishModelFactory {
EventBus eventBus = new EventBus();

Expand All @@ -60,7 +61,7 @@ public class TestInvocationPublishModelFactory {
Environment environment = Mockito.mock(Environment.class);

@Test
public void createDefaultPublishModel() {
public void createDefaultPublishModel() throws Exception {
Mockito.when(environment.getProperty(METRICS_WINDOW_TIME, int.class, DEFAULT_METRICS_WINDOW_TIME))
.thenReturn(DEFAULT_METRICS_WINDOW_TIME);
Mockito.when(environment.getProperty(
Expand Down Expand Up @@ -170,8 +171,8 @@ public void createDefaultPublishModel() {
}
}
""";
Assertions.assertEquals(Json.encodePrettily(Json.decodeValue(expect, Object.class)),
Json.encodePrettily(model.getConsumer()));
JSONAssert.assertEquals(Json.encodePrettily(Json.decodeValue(expect, Object.class)),
Json.encodePrettily(model.getConsumer()), false);

expect = """
{
Expand Down Expand Up @@ -269,8 +270,8 @@ public void createDefaultPublishModel() {
}
}
""";
Assertions.assertEquals(Json.encodePrettily(Json.decodeValue(expect, Object.class)),
Json.encodePrettily(model.getProducer()));
JSONAssert.assertEquals(Json.encodePrettily(Json.decodeValue(expect, Object.class)),
Json.encodePrettily(model.getProducer()), false);
}

protected void prepareInvocation() {
Expand Down
Loading