| package com.a.eye.skywalking.collector.worker.segment.entity.tag; |
| |
| import com.a.eye.skywalking.collector.worker.segment.entity.Span; |
| import java.lang.reflect.Field; |
| import java.util.LinkedHashMap; |
| import java.util.Map; |
| import org.junit.Assert; |
| import org.junit.Test; |
| |
| /** |
| * @author pengys5 |
| */ |
| public class TagsTestCase { |
| |
| @Test |
| public void test() throws NoSuchFieldException, IllegalAccessException { |
| Span span = new Span(); |
| |
| Map<String, String> tagsWithStr = new LinkedHashMap<>(); |
| tagsWithStr.put("span.layer", "db"); |
| |
| Field testAField = span.getClass().getDeclaredField("tagsWithStr"); |
| testAField.setAccessible(true); |
| testAField.set(span, tagsWithStr); |
| |
| Assert.assertEquals("db", Tags.SPAN_LAYER.get(span)); |
| } |
| } |