aboutsummaryrefslogtreecommitdiff
path: root/api/src/test/java/io
diff options
context:
space:
mode:
authorYang Song <songy23@users.noreply.github.com>2018-06-28 09:30:42 -0700
committerGitHub <noreply@github.com>2018-06-28 09:30:42 -0700
commit273c9536f9ec33af05830ce9d7aaf37e35fd86db (patch)
treee5c6d49efebed57ca6837bd21f66e1f7b23fb86c /api/src/test/java/io
parentbcc2bca9861bda13971bb9ca1712f4fe846d20ff (diff)
downloadopencensus-java-273c9536f9ec33af05830ce9d7aaf37e35fd86db.tar.gz
Stats: Add API MeasureMap.putAttachment() for recording exemplars. (#1285)
* Stats: Add API MeasureMap.withAttachments() for recording exemplars. * Add this change to CHANGELOG * Stats: implement the new API in impl. * Rename API and merge the string maps on multiple calls. * Update the API to putAttachment(String, String) for simplicity. * Fix a typo and add a TODO about making putAttachment abstract.
Diffstat (limited to 'api/src/test/java/io')
-rw-r--r--api/src/test/java/io/opencensus/stats/NoopStatsTest.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/api/src/test/java/io/opencensus/stats/NoopStatsTest.java b/api/src/test/java/io/opencensus/stats/NoopStatsTest.java
index b3f81715..4bae14a6 100644
--- a/api/src/test/java/io/opencensus/stats/NoopStatsTest.java
+++ b/api/src/test/java/io/opencensus/stats/NoopStatsTest.java
@@ -93,6 +93,22 @@ public final class NoopStatsTest {
noopStatsComponent.setState(StatsCollectionState.ENABLED);
}
+ @Test
+ public void noopStatsRecorder_PutAttachmentNullKey() {
+ MeasureMap measureMap = NoopStats.getNoopStatsRecorder().newMeasureMap();
+ thrown.expect(NullPointerException.class);
+ thrown.expectMessage("key");
+ measureMap.putAttachment(null, "value");
+ }
+
+ @Test
+ public void noopStatsRecorder_PutAttachmentNullValue() {
+ MeasureMap measureMap = NoopStats.getNoopStatsRecorder().newMeasureMap();
+ thrown.expect(NullPointerException.class);
+ thrown.expectMessage("value");
+ measureMap.putAttachment("key", null);
+ }
+
// The NoopStatsRecorder should do nothing, so this test just checks that record doesn't throw an
// exception.
@Test
@@ -111,6 +127,7 @@ public final class NoopStatsTest {
public void noopStatsRecorder_Record_DisallowNullTagContext() {
MeasureMap measureMap = NoopStats.getNoopStatsRecorder().newMeasureMap();
thrown.expect(NullPointerException.class);
+ thrown.expectMessage("tags");
measureMap.record(null);
}
}