From 9bdb2ef1f3d84e224849889ff8c985be2a544f9d Mon Sep 17 00:00:00 2001 From: mcilwain Date: Wed, 24 Aug 2016 13:48:48 -0700 Subject: [PATCH] Make Stackdriver tests conform to testing practices in rest of codebase The major changes are using the ExpectedException rule instead of a try/catch pattern, asserting the message for thrown exceptions, defaulting to JUnit4 unless Mockito is really necessary, and making each test examine one behavior. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=131211346 --- java/google/registry/monitoring/metrics/LabelDescriptor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/java/google/registry/monitoring/metrics/LabelDescriptor.java b/java/google/registry/monitoring/metrics/LabelDescriptor.java index 85862cfd5..63db68d1f 100644 --- a/java/google/registry/monitoring/metrics/LabelDescriptor.java +++ b/java/google/registry/monitoring/metrics/LabelDescriptor.java @@ -41,11 +41,12 @@ public abstract class LabelDescriptor { * blank */ public static LabelDescriptor create(String name, String description) { + checkArgument(!name.isEmpty(), "Name must not be empty"); + checkArgument(!description.isEmpty(), "Description must not be empty"); checkArgument( ALLOWED_LABEL_PATTERN.matches(name), - "Label must match the regex %s", + "Label name must match the regex %s", ALLOWED_LABEL_PATTERN); - checkArgument(!description.isEmpty(), "Description must not be empty"); return new AutoValue_LabelDescriptor(name, description); }