mirror of
https://github.com/google/nomulus
synced 2026-09-21 07:24:26 +00:00
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
This commit is contained in:
@@ -41,11 +41,12 @@ public abstract class LabelDescriptor {
|
|||||||
* blank
|
* blank
|
||||||
*/
|
*/
|
||||||
public static LabelDescriptor create(String name, String description) {
|
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(
|
checkArgument(
|
||||||
ALLOWED_LABEL_PATTERN.matches(name),
|
ALLOWED_LABEL_PATTERN.matches(name),
|
||||||
"Label must match the regex %s",
|
"Label name must match the regex %s",
|
||||||
ALLOWED_LABEL_PATTERN);
|
ALLOWED_LABEL_PATTERN);
|
||||||
checkArgument(!description.isEmpty(), "Description must not be empty");
|
|
||||||
|
|
||||||
return new AutoValue_LabelDescriptor(name, description);
|
return new AutoValue_LabelDescriptor(name, description);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user