use of io.opencensus.tags.TagContextBuilder in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method currentBuilder_TaggingReenabled.
@Test
public void currentBuilder_TaggingReenabled() {
TagContext tags = new SimpleTagContext(TAG1);
tagsComponent.setState(TaggingState.DISABLED);
assertThat(getResultOfCurrentBuilder(tags)).isSameInstanceAs(NoopTagMapBuilder.INSTANCE);
tagsComponent.setState(TaggingState.ENABLED);
TagContextBuilder builder = getResultOfCurrentBuilder(tags);
assertThat(builder).isInstanceOf(TagMapBuilderImpl.class);
assertThat(tagContextToList(builder.build())).containsExactly(TAG1);
}
use of io.opencensus.tags.TagContextBuilder in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method currentBuilder_DefaultIsEmpty.
@Test
public void currentBuilder_DefaultIsEmpty() {
TagContextBuilder currentBuilder = tagger.currentBuilder();
assertThat(currentBuilder).isInstanceOf(TagMapBuilderImpl.class);
assertThat(tagContextToList(currentBuilder.build())).isEmpty();
}
use of io.opencensus.tags.TagContextBuilder in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method toBuilder_TaggingReenabled.
@Test
public void toBuilder_TaggingReenabled() {
TagContext tags = new SimpleTagContext(TAG1);
tagsComponent.setState(TaggingState.DISABLED);
assertThat(tagger.toBuilder(tags)).isSameInstanceAs(NoopTagMapBuilder.INSTANCE);
tagsComponent.setState(TaggingState.ENABLED);
TagContextBuilder builder = tagger.toBuilder(tags);
assertThat(builder).isInstanceOf(TagMapBuilderImpl.class);
assertThat(tagContextToList(builder.build())).containsExactly(TAG1);
}
use of io.opencensus.tags.TagContextBuilder in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method currentBuilder_SkipNullTag.
@Test
public void currentBuilder_SkipNullTag() {
TagContext tagContextWithNullTag = new SimpleTagContext(TAG1, null, TAG2);
TagContextBuilder result = getResultOfCurrentBuilder(tagContextWithNullTag);
assertThat(tagContextToList(result.build())).containsExactly(TAG1, TAG2);
}
use of io.opencensus.tags.TagContextBuilder in project instrumentation-java by census-instrumentation.
the class TaggerImplTest method currentBuilder.
@Test
public void currentBuilder() {
TagContext tags = new SimpleTagContext(TAG1, TAG2, TAG3);
TagContextBuilder result = getResultOfCurrentBuilder(tags);
assertThat(result).isInstanceOf(TagMapBuilderImpl.class);
assertThat(tagContextToList(result.build())).containsExactly(TAG1, TAG2, TAG3);
}
Aggregations