From 2f53b977da6b10b7f8e8c29d83f0478d470b229c Mon Sep 17 00:00:00 2001 From: Mayur Kale Date: Wed, 17 Oct 2018 19:25:19 -0700 Subject: Remove Old Gauge and correct exception messages (#1502) --- .../java/io/opencensus/metrics/DoubleGauge.java | 10 +- .../main/java/io/opencensus/metrics/LongGauge.java | 6 +- .../main/java/io/opencensus/stats/Aggregation.java | 2 +- .../java/io/opencensus/stats/AggregationData.java | 6 +- .../java/io/opencensus/stats/BucketBoundaries.java | 2 +- .../io/opencensus/metrics/DoubleGaugeTest.java | 6 +- .../java/io/opencensus/metrics/LongGaugeTest.java | 6 +- .../io/opencensus/stats/AggregationDataTest.java | 6 +- .../java/io/opencensus/stats/AggregationTest.java | 2 +- .../implcore/metrics/DoubleGaugeImpl.java | 7 +- .../java/io/opencensus/implcore/metrics/Gauge.java | 109 --------------------- .../opencensus/implcore/metrics/LongGaugeImpl.java | 7 +- .../implcore/metrics/DoubleGaugeImplTest.java | 6 +- .../io/opencensus/implcore/metrics/GaugeTest.java | 106 -------------------- .../implcore/metrics/LongGaugeImplTest.java | 6 +- 15 files changed, 35 insertions(+), 252 deletions(-) delete mode 100644 impl_core/src/main/java/io/opencensus/implcore/metrics/Gauge.java delete mode 100644 impl_core/src/test/java/io/opencensus/implcore/metrics/GaugeTest.java diff --git a/api/src/main/java/io/opencensus/metrics/DoubleGauge.java b/api/src/main/java/io/opencensus/metrics/DoubleGauge.java index 62730a06..de2b053b 100644 --- a/api/src/main/java/io/opencensus/metrics/DoubleGauge.java +++ b/api/src/main/java/io/opencensus/metrics/DoubleGauge.java @@ -172,15 +172,15 @@ public abstract class DoubleGauge { Utils.checkNotNull(name, "name"); Utils.checkNotNull(description, "description"); Utils.checkNotNull(unit, "unit"); - Utils.checkNotNull(labelKeys, "labelKeys should not be null."); - Utils.checkListElementNotNull(labelKeys, "labelKeys element should not be null."); + Utils.checkListElementNotNull( + Utils.checkNotNull(labelKeys, "labelKeys"), "labelKey element should not be null."); labelKeysSize = labelKeys.size(); } @Override public NoopDoublePoint getOrCreateTimeSeries(List labelValues) { - Utils.checkNotNull(labelValues, "labelValues should not be null."); - Utils.checkListElementNotNull(labelValues, "labelValues element should not be null."); + Utils.checkListElementNotNull( + Utils.checkNotNull(labelValues, "labelValues"), "labelValue element should not be null."); Utils.checkArgument(labelKeysSize == labelValues.size(), "Incorrect number of labels."); return NoopDoublePoint.INSTANCE; } @@ -192,7 +192,7 @@ public abstract class DoubleGauge { @Override public void removeTimeSeries(List labelValues) { - Utils.checkNotNull(labelValues, "labelValues should not be null."); + Utils.checkNotNull(labelValues, "labelValues"); } @Override diff --git a/api/src/main/java/io/opencensus/metrics/LongGauge.java b/api/src/main/java/io/opencensus/metrics/LongGauge.java index f473a8ac..8ca760be 100644 --- a/api/src/main/java/io/opencensus/metrics/LongGauge.java +++ b/api/src/main/java/io/opencensus/metrics/LongGauge.java @@ -171,8 +171,8 @@ public abstract class LongGauge { @Override public NoopLongPoint getOrCreateTimeSeries(List labelValues) { - Utils.checkNotNull(labelValues, "labelValues should not be null."); - Utils.checkListElementNotNull(labelValues, "labelValues element should not be null."); + Utils.checkListElementNotNull( + Utils.checkNotNull(labelValues, "labelValues"), "labelValue element should not be null."); Utils.checkArgument(labelKeysSize == labelValues.size(), "Incorrect number of labels."); return NoopLongPoint.INSTANCE; } @@ -184,7 +184,7 @@ public abstract class LongGauge { @Override public void removeTimeSeries(List labelValues) { - Utils.checkNotNull(labelValues, "labelValues should not be null."); + Utils.checkNotNull(labelValues, "labelValues"); } @Override diff --git a/api/src/main/java/io/opencensus/stats/Aggregation.java b/api/src/main/java/io/opencensus/stats/Aggregation.java index f5efed9b..9c95e847 100644 --- a/api/src/main/java/io/opencensus/stats/Aggregation.java +++ b/api/src/main/java/io/opencensus/stats/Aggregation.java @@ -180,7 +180,7 @@ public abstract class Aggregation { * @since 0.8 */ public static Distribution create(BucketBoundaries bucketBoundaries) { - Utils.checkNotNull(bucketBoundaries, "bucketBoundaries should not be null."); + Utils.checkNotNull(bucketBoundaries, "bucketBoundaries"); return new AutoValue_Aggregation_Distribution(bucketBoundaries); } diff --git a/api/src/main/java/io/opencensus/stats/AggregationData.java b/api/src/main/java/io/opencensus/stats/AggregationData.java index eb7d40b3..c6e12b67 100644 --- a/api/src/main/java/io/opencensus/stats/AggregationData.java +++ b/api/src/main/java/io/opencensus/stats/AggregationData.java @@ -288,15 +288,15 @@ public abstract class AggregationData { Utils.checkArgument(min <= max, "max should be greater or equal to min."); } - Utils.checkNotNull(bucketCounts, "bucket counts should not be null."); + Utils.checkNotNull(bucketCounts, "bucketCounts"); List bucketCountsCopy = Collections.unmodifiableList(new ArrayList(bucketCounts)); for (Long bucket : bucketCountsCopy) { - Utils.checkNotNull(bucket, "bucket should not be null."); + Utils.checkNotNull(bucket, "bucket"); } Utils.checkNotNull(exemplars, "exemplar list should not be null."); for (Exemplar exemplar : exemplars) { - Utils.checkNotNull(exemplar, "exemplar should not be null."); + Utils.checkNotNull(exemplar, "exemplar"); } return new AutoValue_AggregationData_DistributionData( diff --git a/api/src/main/java/io/opencensus/stats/BucketBoundaries.java b/api/src/main/java/io/opencensus/stats/BucketBoundaries.java index 573a9e10..61e21e6c 100644 --- a/api/src/main/java/io/opencensus/stats/BucketBoundaries.java +++ b/api/src/main/java/io/opencensus/stats/BucketBoundaries.java @@ -42,7 +42,7 @@ public abstract class BucketBoundaries { * @since 0.8 */ public static final BucketBoundaries create(List bucketBoundaries) { - Utils.checkNotNull(bucketBoundaries, "bucketBoundaries list should not be null."); + Utils.checkNotNull(bucketBoundaries, "bucketBoundaries"); List bucketBoundariesCopy = new ArrayList(bucketBoundaries); // Deep copy. // Check if sorted. if (bucketBoundariesCopy.size() > 1) { diff --git a/api/src/test/java/io/opencensus/metrics/DoubleGaugeTest.java b/api/src/test/java/io/opencensus/metrics/DoubleGaugeTest.java index 5690bd44..b0cdea7c 100644 --- a/api/src/test/java/io/opencensus/metrics/DoubleGaugeTest.java +++ b/api/src/test/java/io/opencensus/metrics/DoubleGaugeTest.java @@ -49,7 +49,7 @@ public class DoubleGaugeTest { DoubleGauge doubleGauge = DoubleGauge.newNoopDoubleGauge(NAME, DESCRIPTION, UNIT, EMPTY_LABEL_KEYS); thrown.expect(NullPointerException.class); - thrown.expectMessage("labelValues should not be null."); + thrown.expectMessage("labelValues"); doubleGauge.getOrCreateTimeSeries(null); } @@ -58,7 +58,7 @@ public class DoubleGaugeTest { List labelValues = Collections.singletonList(null); DoubleGauge doubleGauge = DoubleGauge.newNoopDoubleGauge(NAME, DESCRIPTION, UNIT, LABEL_KEY); thrown.expect(NullPointerException.class); - thrown.expectMessage("labelValues element should not be null."); + thrown.expectMessage("labelValue element should not be null."); doubleGauge.getOrCreateTimeSeries(labelValues); } @@ -74,7 +74,7 @@ public class DoubleGaugeTest { public void noopRemoveTimeSeries_WithNullLabelValues() { DoubleGauge doubleGauge = DoubleGauge.newNoopDoubleGauge(NAME, DESCRIPTION, UNIT, LABEL_KEY); thrown.expect(NullPointerException.class); - thrown.expectMessage("labelValues should not be null."); + thrown.expectMessage("labelValues"); doubleGauge.removeTimeSeries(null); } diff --git a/api/src/test/java/io/opencensus/metrics/LongGaugeTest.java b/api/src/test/java/io/opencensus/metrics/LongGaugeTest.java index 768abe06..eedb287c 100644 --- a/api/src/test/java/io/opencensus/metrics/LongGaugeTest.java +++ b/api/src/test/java/io/opencensus/metrics/LongGaugeTest.java @@ -48,7 +48,7 @@ public class LongGaugeTest { public void noopGetOrCreateTimeSeries_WithNullLabelValues() { LongGauge longGauge = LongGauge.newNoopLongGauge(NAME, DESCRIPTION, UNIT, EMPTY_LABEL_KEYS); thrown.expect(NullPointerException.class); - thrown.expectMessage("labelValues should not be null."); + thrown.expectMessage("labelValues"); longGauge.getOrCreateTimeSeries(null); } @@ -57,7 +57,7 @@ public class LongGaugeTest { List labelValues = Collections.singletonList(null); LongGauge longGauge = LongGauge.newNoopLongGauge(NAME, DESCRIPTION, UNIT, LABEL_KEY); thrown.expect(NullPointerException.class); - thrown.expectMessage("labelValues element should not be null."); + thrown.expectMessage("labelValue element should not be null."); longGauge.getOrCreateTimeSeries(labelValues); } @@ -73,7 +73,7 @@ public class LongGaugeTest { public void noopRemoveTimeSeries_WithNullLabelValues() { LongGauge longGauge = LongGauge.newNoopLongGauge(NAME, DESCRIPTION, UNIT, LABEL_KEY); thrown.expect(NullPointerException.class); - thrown.expectMessage("labelValues should not be null."); + thrown.expectMessage("labelValues"); longGauge.removeTimeSeries(null); } diff --git a/api/src/test/java/io/opencensus/stats/AggregationDataTest.java b/api/src/test/java/io/opencensus/stats/AggregationDataTest.java index 60551600..a6d6d1de 100644 --- a/api/src/test/java/io/opencensus/stats/AggregationDataTest.java +++ b/api/src/test/java/io/opencensus/stats/AggregationDataTest.java @@ -108,14 +108,14 @@ public class AggregationDataTest { @Test public void preventNullBucketCountList() { thrown.expect(NullPointerException.class); - thrown.expectMessage("bucket counts should not be null."); + thrown.expectMessage("bucketCounts"); DistributionData.create(1, 1, 1, 1, 0, null); } @Test public void preventNullBucket() { thrown.expect(NullPointerException.class); - thrown.expectMessage("bucket should not be null."); + thrown.expectMessage("bucket"); DistributionData.create(1, 1, 1, 1, 0, Arrays.asList(0L, 1L, null)); } @@ -129,7 +129,7 @@ public class AggregationDataTest { @Test public void preventNullExemplar() { thrown.expect(NullPointerException.class); - thrown.expectMessage("exemplar should not be null."); + thrown.expectMessage("exemplar"); DistributionData.create( 1, 1, 1, 1, 0, Arrays.asList(0L, 1L, 1L), Collections.singletonList(null)); } diff --git a/api/src/test/java/io/opencensus/stats/AggregationTest.java b/api/src/test/java/io/opencensus/stats/AggregationTest.java index c2e6a716..cf337030 100644 --- a/api/src/test/java/io/opencensus/stats/AggregationTest.java +++ b/api/src/test/java/io/opencensus/stats/AggregationTest.java @@ -50,7 +50,7 @@ public class AggregationTest { @Test public void testNullBucketBoundaries() { thrown.expect(NullPointerException.class); - thrown.expectMessage("bucketBoundaries should not be null."); + thrown.expectMessage("bucketBoundaries"); Distribution.create(null); } diff --git a/impl_core/src/main/java/io/opencensus/implcore/metrics/DoubleGaugeImpl.java b/impl_core/src/main/java/io/opencensus/implcore/metrics/DoubleGaugeImpl.java index d329091e..86b3512d 100644 --- a/impl_core/src/main/java/io/opencensus/implcore/metrics/DoubleGaugeImpl.java +++ b/impl_core/src/main/java/io/opencensus/implcore/metrics/DoubleGaugeImpl.java @@ -70,8 +70,7 @@ public final class DoubleGaugeImpl extends DoubleGauge implements Meter { List labelValuesCopy = Collections.unmodifiableList( - new ArrayList( - checkNotNull(labelValues, "labelValues should not be null."))); + new ArrayList(checkNotNull(labelValues, "labelValues"))); return registerTimeSeries(labelValuesCopy); } @@ -87,7 +86,7 @@ public final class DoubleGaugeImpl extends DoubleGauge implements Meter { @Override public synchronized void removeTimeSeries(List labelValues) { - checkNotNull(labelValues, "labelValues should not be null."); + checkNotNull(labelValues, "labelValues"); Map, PointImpl> registeredPointsCopy = new LinkedHashMap, PointImpl>(registeredPoints); @@ -112,7 +111,7 @@ public final class DoubleGaugeImpl extends DoubleGauge implements Meter { } checkArgument(labelKeysSize == labelValues.size(), "Incorrect number of labels."); - Utils.checkListElementNotNull(labelValues, "labelValues element should not be null."); + Utils.checkListElementNotNull(labelValues, "labelValue element should not be null."); PointImpl newPoint = new PointImpl(labelValues); // Updating the map of points happens under a lock to avoid multiple add operations diff --git a/impl_core/src/main/java/io/opencensus/implcore/metrics/Gauge.java b/impl_core/src/main/java/io/opencensus/implcore/metrics/Gauge.java deleted file mode 100644 index e52fcff5..00000000 --- a/impl_core/src/main/java/io/opencensus/implcore/metrics/Gauge.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2018, OpenCensus Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.opencensus.implcore.metrics; - -import static com.google.common.base.Preconditions.checkNotNull; - -import io.opencensus.common.Clock; -import io.opencensus.common.ToDoubleFunction; -import io.opencensus.common.ToLongFunction; -import io.opencensus.metrics.LabelKey; -import io.opencensus.metrics.LabelValue; -import io.opencensus.metrics.export.Metric; -import io.opencensus.metrics.export.MetricDescriptor; -import io.opencensus.metrics.export.MetricDescriptor.Type; -import io.opencensus.metrics.export.Point; -import io.opencensus.metrics.export.TimeSeries; -import io.opencensus.metrics.export.Value; -import java.util.Collections; -import java.util.List; - -abstract class Gauge { - private final MetricDescriptor metricDescriptor; - private final List labelValues; - - final Metric getMetric(Clock clock) { - return Metric.createWithOneTimeSeries(metricDescriptor, getTimeSeries(clock)); - } - - abstract TimeSeries getTimeSeries(Clock clock); - - static final class DoubleGauge extends Gauge { - private final T obj; - private final ToDoubleFunction function; - - DoubleGauge( - String name, - String description, - String unit, - List labelKeys, - List labelValues, - T obj, - ToDoubleFunction function) { - super( - MetricDescriptor.create(name, description, unit, Type.GAUGE_DOUBLE, labelKeys), - labelValues); - this.obj = obj; - this.function = function; - } - - @Override - TimeSeries getTimeSeries(Clock clock) { - return TimeSeries.createWithOnePoint( - getLabelValues(), - Point.create(Value.doubleValue(function.applyAsDouble(obj)), clock.now()), - null); - } - } - - static final class LongGauge extends Gauge { - private final T obj; - private final ToLongFunction function; - - LongGauge( - String name, - String description, - String unit, - List labelKeys, - List labelValues, - T obj, - ToLongFunction function) { - super( - MetricDescriptor.create(name, description, unit, Type.GAUGE_INT64, labelKeys), - labelValues); - this.obj = obj; - this.function = function; - } - - @Override - TimeSeries getTimeSeries(Clock clock) { - return TimeSeries.createWithOnePoint( - getLabelValues(), - Point.create(Value.longValue(function.applyAsLong(obj)), clock.now()), - null); - } - } - - List getLabelValues() { - return labelValues; - } - - Gauge(MetricDescriptor metricDescriptor, List labelValues) { - this.metricDescriptor = checkNotNull(metricDescriptor, "metricDescriptor"); - this.labelValues = Collections.unmodifiableList(labelValues); - } -} diff --git a/impl_core/src/main/java/io/opencensus/implcore/metrics/LongGaugeImpl.java b/impl_core/src/main/java/io/opencensus/implcore/metrics/LongGaugeImpl.java index 64cb3200..f158e656 100644 --- a/impl_core/src/main/java/io/opencensus/implcore/metrics/LongGaugeImpl.java +++ b/impl_core/src/main/java/io/opencensus/implcore/metrics/LongGaugeImpl.java @@ -70,8 +70,7 @@ public final class LongGaugeImpl extends LongGauge implements Meter { List labelValuesCopy = Collections.unmodifiableList( - new ArrayList( - checkNotNull(labelValues, "labelValues should not be null."))); + new ArrayList(checkNotNull(labelValues, "labelValues"))); return registerTimeSeries(labelValuesCopy); } @@ -87,7 +86,7 @@ public final class LongGaugeImpl extends LongGauge implements Meter { @Override public synchronized void removeTimeSeries(List labelValues) { - checkNotNull(labelValues, "labelValues should not be null."); + checkNotNull(labelValues, "labelValues"); Map, PointImpl> registeredPointsCopy = new LinkedHashMap, PointImpl>(registeredPoints); @@ -112,7 +111,7 @@ public final class LongGaugeImpl extends LongGauge implements Meter { } checkArgument(labelKeysSize == labelValues.size(), "Incorrect number of labels."); - Utils.checkListElementNotNull(labelValues, "labelValues element should not be null."); + Utils.checkListElementNotNull(labelValues, "labelValue element should not be null."); PointImpl newPoint = new PointImpl(labelValues); // Updating the map of points happens under a lock to avoid multiple add operations diff --git a/impl_core/src/test/java/io/opencensus/implcore/metrics/DoubleGaugeImplTest.java b/impl_core/src/test/java/io/opencensus/implcore/metrics/DoubleGaugeImplTest.java index 61de77b6..b0899084 100644 --- a/impl_core/src/test/java/io/opencensus/implcore/metrics/DoubleGaugeImplTest.java +++ b/impl_core/src/test/java/io/opencensus/implcore/metrics/DoubleGaugeImplTest.java @@ -69,7 +69,7 @@ public class DoubleGaugeImplTest { @Test public void getOrCreateTimeSeries_WithNullLabelValues() { thrown.expect(NullPointerException.class); - thrown.expectMessage("labelValues should not be null."); + thrown.expectMessage("labelValues"); doubleGauge.getOrCreateTimeSeries(null); } @@ -82,7 +82,7 @@ public class DoubleGaugeImplTest { DoubleGaugeImpl doubleGauge = new DoubleGaugeImpl(METRIC_NAME, METRIC_DESCRIPTION, METRIC_UNIT, labelKeys); thrown.expect(NullPointerException.class); - thrown.expectMessage("labelValues element should not be null."); + thrown.expectMessage("labelValue element should not be null."); doubleGauge.getOrCreateTimeSeries(labelValues); } @@ -174,7 +174,7 @@ public class DoubleGaugeImplTest { @Test public void removeTimeSeries_WithNullLabelValues() { thrown.expect(NullPointerException.class); - thrown.expectMessage("labelValues should not be null."); + thrown.expectMessage("labelValues"); doubleGauge.removeTimeSeries(null); } diff --git a/impl_core/src/test/java/io/opencensus/implcore/metrics/GaugeTest.java b/impl_core/src/test/java/io/opencensus/implcore/metrics/GaugeTest.java deleted file mode 100644 index 4c4c3a92..00000000 --- a/impl_core/src/test/java/io/opencensus/implcore/metrics/GaugeTest.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2018, OpenCensus Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.opencensus.implcore.metrics; - -import static com.google.common.truth.Truth.assertThat; - -import io.opencensus.common.Timestamp; -import io.opencensus.common.ToDoubleFunction; -import io.opencensus.common.ToLongFunction; -import io.opencensus.implcore.metrics.Gauge.DoubleGauge; -import io.opencensus.implcore.metrics.Gauge.LongGauge; -import io.opencensus.metrics.LabelKey; -import io.opencensus.metrics.LabelValue; -import io.opencensus.metrics.export.Metric; -import io.opencensus.metrics.export.MetricDescriptor; -import io.opencensus.metrics.export.MetricDescriptor.Type; -import io.opencensus.metrics.export.Point; -import io.opencensus.metrics.export.TimeSeries; -import io.opencensus.metrics.export.Value; -import io.opencensus.testing.common.TestClock; -import java.util.Collections; -import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Unit tests for {@link Gauge}. */ -@RunWith(JUnit4.class) -public class GaugeTest { - private static final String NAME = "name"; - private static final String DESCRIPTION = "description"; - private static final String UNIT = "1"; - private static final List LABEL_KEYS = - Collections.unmodifiableList( - Collections.singletonList(LabelKey.create("key", "key description"))); - private static final List LABEL_VALUES = - Collections.unmodifiableList(Collections.singletonList(LabelValue.create("value"))); - private static final Object OBJ = new Object(); - private static final Timestamp TEST_TIME = Timestamp.create(1234, 123); - - private final Gauge longGauge = - new LongGauge( - NAME, - DESCRIPTION, - UNIT, - LABEL_KEYS, - LABEL_VALUES, - OBJ, - new ToLongFunction() { - @Override - public long applyAsLong(Object value) { - return value.hashCode(); - } - }); - private final Gauge doubleGauge = - new DoubleGauge( - NAME, - DESCRIPTION, - UNIT, - LABEL_KEYS, - LABEL_VALUES, - OBJ, - new ToDoubleFunction() { - @Override - public double applyAsDouble(Object value) { - return value.hashCode(); - } - }); - private final TestClock testClock = TestClock.create(TEST_TIME); - - @Test - public void longGauge_GetMetric() { - assertThat(longGauge.getMetric(testClock)) - .isEqualTo( - Metric.createWithOneTimeSeries( - MetricDescriptor.create(NAME, DESCRIPTION, UNIT, Type.GAUGE_INT64, LABEL_KEYS), - TimeSeries.createWithOnePoint( - LABEL_VALUES, Point.create(Value.longValue(OBJ.hashCode()), TEST_TIME), null))); - } - - @Test - public void doubleGauge_GetMetric() { - assertThat(doubleGauge.getMetric(testClock)) - .isEqualTo( - Metric.createWithOneTimeSeries( - MetricDescriptor.create(NAME, DESCRIPTION, UNIT, Type.GAUGE_DOUBLE, LABEL_KEYS), - TimeSeries.createWithOnePoint( - LABEL_VALUES, - Point.create(Value.doubleValue(OBJ.hashCode()), TEST_TIME), - null))); - } -} diff --git a/impl_core/src/test/java/io/opencensus/implcore/metrics/LongGaugeImplTest.java b/impl_core/src/test/java/io/opencensus/implcore/metrics/LongGaugeImplTest.java index 25797cff..e83bb642 100644 --- a/impl_core/src/test/java/io/opencensus/implcore/metrics/LongGaugeImplTest.java +++ b/impl_core/src/test/java/io/opencensus/implcore/metrics/LongGaugeImplTest.java @@ -69,7 +69,7 @@ public class LongGaugeImplTest { @Test public void getOrCreateTimeSeries_WithNullLabelValues() { thrown.expect(NullPointerException.class); - thrown.expectMessage("labelValues should not be null."); + thrown.expectMessage("labelValues"); longGaugeMetric.getOrCreateTimeSeries(null); } @@ -82,7 +82,7 @@ public class LongGaugeImplTest { LongGaugeImpl longGauge = new LongGaugeImpl(METRIC_NAME, METRIC_DESCRIPTION, METRIC_UNIT, labelKeys); thrown.expect(NullPointerException.class); - thrown.expectMessage("labelValues element should not be null."); + thrown.expectMessage("labelValue element should not be null."); longGauge.getOrCreateTimeSeries(labelValues); } @@ -169,7 +169,7 @@ public class LongGaugeImplTest { @Test public void removeTimeSeries_WithNullLabelValues() { thrown.expect(NullPointerException.class); - thrown.expectMessage("labelValues should not be null."); + thrown.expectMessage("labelValues"); longGaugeMetric.removeTimeSeries(null); } -- cgit v1.2.3