diff options
author | Bogdan Drutu <bdrutu@google.com> | 2018-10-13 14:21:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-13 14:21:09 -0700 |
commit | 7c6a1e66dd8ff52aaf99fb086df656db149b58d5 (patch) | |
tree | 6ea4e057c1f8a4a53e6493672c32ec933746f553 /api/src/test/java/io/opencensus/metrics | |
parent | 135dcd99d7fdd42c7d6fe1116a8978ca7e5ec9a7 (diff) | |
download | opencensus-java-7c6a1e66dd8ff52aaf99fb086df656db149b58d5.tar.gz |
Cleanup metrics API exception messages. (#1494)
* Cleanup metrics API exception messages.
* Fix MutableAggregationTest.java
Diffstat (limited to 'api/src/test/java/io/opencensus/metrics')
-rw-r--r-- | api/src/test/java/io/opencensus/metrics/export/DistributionTest.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/api/src/test/java/io/opencensus/metrics/export/DistributionTest.java b/api/src/test/java/io/opencensus/metrics/export/DistributionTest.java index ad89d338..85b31498 100644 --- a/api/src/test/java/io/opencensus/metrics/export/DistributionTest.java +++ b/api/src/test/java/io/opencensus/metrics/export/DistributionTest.java @@ -98,9 +98,9 @@ public class DistributionTest { @Test public void createAndGet_ExplicitBucketsNegativeBounds() { - List<Double> bucketBounds = Arrays.asList(-1.0); + List<Double> bucketBounds = Collections.singletonList(-1.0); thrown.expect(IllegalArgumentException.class); - thrown.expectMessage("bucket boundaries should be > 0"); + thrown.expectMessage("bucket boundary should be > 0"); BucketOptions.explicitOptions(bucketBounds); } @@ -252,15 +252,25 @@ public class DistributionTest { } @Test - public void createDistribution_NullBucketBounds() { + public void createDistribution_NullBucketBoundaries() { List<Bucket> buckets = Arrays.asList(Bucket.create(3), Bucket.create(1), Bucket.create(2), Bucket.create(4)); thrown.expect(NullPointerException.class); - thrown.expectMessage("bucketBoundaries list should not be null."); + thrown.expectMessage("bucketBoundaries"); Distribution.create(10, 6.6, 678.54, BucketOptions.explicitOptions(null), buckets); } @Test + public void createDistribution_NullBucketBoundary() { + List<Bucket> buckets = + Arrays.asList(Bucket.create(3), Bucket.create(1), Bucket.create(2), Bucket.create(4)); + thrown.expect(NullPointerException.class); + thrown.expectMessage("bucketBoundary"); + Distribution.create( + 10, 6.6, 678.54, BucketOptions.explicitOptions(Arrays.asList(2.5, null)), buckets); + } + + @Test public void createDistribution_NullBucketOptions() { List<Bucket> buckets = Arrays.asList(Bucket.create(3), Bucket.create(1), Bucket.create(2), Bucket.create(4)); @@ -274,7 +284,7 @@ public class DistributionTest { List<Double> bucketBounds = Arrays.asList(1.0, 2.0, 5.0); BucketOptions bucketOptions = BucketOptions.explicitOptions(bucketBounds); thrown.expect(NullPointerException.class); - thrown.expectMessage("bucket list should not be null."); + thrown.expectMessage("buckets"); Distribution.create(10, 6.6, 678.54, bucketOptions, null); } @@ -285,7 +295,7 @@ public class DistributionTest { List<Bucket> buckets = Arrays.asList(Bucket.create(3), Bucket.create(1), null, Bucket.create(4)); thrown.expect(NullPointerException.class); - thrown.expectMessage("bucket should not be null."); + thrown.expectMessage("bucket"); Distribution.create(10, 6.6, 678.54, bucketOptions, buckets); } |