Cleanup metrics API exception messages. (#1494)

* Cleanup metrics API exception messages.

* Fix MutableAggregationTest.java
diff --git a/api/src/main/java/io/opencensus/metrics/export/Distribution.java b/api/src/main/java/io/opencensus/metrics/export/Distribution.java
index eb0add8..d55f101 100644
--- a/api/src/main/java/io/opencensus/metrics/export/Distribution.java
+++ b/api/src/main/java/io/opencensus/metrics/export/Distribution.java
@@ -69,16 +69,11 @@
           sumOfSquaredDeviations == 0, "sum of squared deviations should be 0 if count is 0.");
     }
     Utils.checkNotNull(bucketOptions, "bucketOptions");
-
+    List<Bucket> bucketsCopy =
+        Collections.unmodifiableList(new ArrayList<Bucket>(Utils.checkNotNull(buckets, "buckets")));
+    Utils.checkListElementNotNull(bucketsCopy, "bucket");
     return new AutoValue_Distribution(
-        count, sum, sumOfSquaredDeviations, bucketOptions, copyBucketCount(buckets));
-  }
-
-  private static List<Bucket> copyBucketCount(List<Bucket> buckets) {
-    Utils.checkNotNull(buckets, "bucket list should not be null.");
-    List<Bucket> bucketsCopy = new ArrayList<Bucket>(buckets);
-    Utils.checkListElementNotNull(bucketsCopy, "bucket should not be null.");
-    return Collections.unmodifiableList(bucketsCopy);
+        count, sum, sumOfSquaredDeviations, bucketOptions, bucketsCopy);
   }
 
   /**
@@ -204,24 +199,23 @@
        * @since 0.17
        */
       private static ExplicitOptions create(List<Double> bucketBoundaries) {
-        Utils.checkNotNull(bucketBoundaries, "bucketBoundaries list should not be null.");
-        return new AutoValue_Distribution_BucketOptions_ExplicitOptions(
-            checkBucketBoundsAreSorted(bucketBoundaries));
+        Utils.checkNotNull(bucketBoundaries, "bucketBoundaries");
+        List<Double> bucketBoundariesCopy =
+            Collections.unmodifiableList(new ArrayList<Double>(bucketBoundaries));
+        checkBucketBoundsAreSorted(bucketBoundariesCopy);
+        return new AutoValue_Distribution_BucketOptions_ExplicitOptions(bucketBoundariesCopy);
       }
 
-      private static List<Double> checkBucketBoundsAreSorted(List<Double> bucketBoundaries) {
-        List<Double> bucketBoundariesCopy = new ArrayList<Double>(bucketBoundaries); // Deep copy.
-        // Check if sorted.
-        if (bucketBoundariesCopy.size() >= 1) {
-          double previous = bucketBoundariesCopy.get(0);
-          Utils.checkArgument(previous > 0, "bucket boundaries should be > 0");
-          for (int i = 1; i < bucketBoundariesCopy.size(); i++) {
-            double next = bucketBoundariesCopy.get(i);
+      private static void checkBucketBoundsAreSorted(List<Double> bucketBoundaries) {
+        if (bucketBoundaries.size() >= 1) {
+          double previous = Utils.checkNotNull(bucketBoundaries.get(0), "bucketBoundary");
+          Utils.checkArgument(previous > 0, "bucket boundary should be > 0");
+          for (int i = 1; i < bucketBoundaries.size(); i++) {
+            double next = Utils.checkNotNull(bucketBoundaries.get(i), "bucketBoundary");
             Utils.checkArgument(previous < next, "bucket boundaries not sorted.");
             previous = next;
           }
         }
-        return Collections.unmodifiableList(bucketBoundariesCopy);
       }
 
       /**
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 ad89d33..85b3149 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 @@
 
   @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 @@
   }
 
   @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 @@
     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 @@
     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);
   }
 
diff --git a/impl_core/src/test/java/io/opencensus/implcore/stats/MutableAggregationTest.java b/impl_core/src/test/java/io/opencensus/implcore/stats/MutableAggregationTest.java
index bf76b8f..a6139e5 100644
--- a/impl_core/src/test/java/io/opencensus/implcore/stats/MutableAggregationTest.java
+++ b/impl_core/src/test/java/io/opencensus/implcore/stats/MutableAggregationTest.java
@@ -300,7 +300,7 @@
         .isEqualTo(Point.create(Value.doubleValue(0), TIMESTAMP));
 
     thrown.expect(IllegalArgumentException.class);
-    thrown.expectMessage("bucket boundaries should be > 0");
+    thrown.expectMessage("bucket boundary should be > 0");
     assertThat(MutableDistribution.create(BUCKET_BOUNDARIES).toPoint(TIMESTAMP))
         .isEqualTo(
             Point.create(