mirror of
https://github.com/google/nomulus.git
synced 2025-05-16 17:37:13 +02: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:
parent
1c5b4e16c6
commit
9bdb2ef1f3
1 changed files with 3 additions and 2 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue