提交 6745e50f 编写于 作者: wu-sheng's avatar wu-sheng

Fix a test case.

上级 673b9757
...@@ -2,8 +2,10 @@ package org.skywalking.apm.trace; ...@@ -2,8 +2,10 @@ package org.skywalking.apm.trace;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.skywalking.apm.trace.tag.StringTagReader;
import org.skywalking.apm.trace.tag.Tags; import org.skywalking.apm.trace.tag.Tags;
/** /**
...@@ -116,6 +118,12 @@ public class TraceSegmentTestCase { ...@@ -116,6 +118,12 @@ public class TraceSegmentTestCase {
Assert.assertEquals(length, segmentJson.length()); Assert.assertEquals(length, segmentJson.length());
System.out.println(segmentJson); JsonObject jsonObject = gson.fromJson(segmentJson, JsonObject.class);
Assert.assertEquals(segment.getSpans().size(), jsonObject.get("ss").getAsJsonArray().size());
Assert.assertEquals(segment.getRefs().get(0).getTraceSegmentId(),
jsonObject.get("rs").getAsJsonArray().get(0).getAsJsonObject().get("ts").getAsString());
Assert.assertEquals(StringTagReader.get(segment.getSpans().get(1), Tags.SPAN_LAYER.SPAN_LAYER_TAG),
jsonObject.get("ss").getAsJsonArray().get(1).getAsJsonObject().get("ts").getAsJsonObject().get("span.layer").getAsString());
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册