mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 17:07:15 +02:00
Add test which verifies that all commands have descriptions
Besides being good practice, this works around a bug in JCommander 1.48, which we are stuck with for now since newer versions of the library are Java 8 only: https://github.com/cbeust/jcommander/issues/270 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=149565357
This commit is contained in:
parent
01bb3a30f2
commit
9eddbe2b6e
1 changed files with 11 additions and 0 deletions
|
@ -19,6 +19,7 @@ import static com.google.common.base.CaseFormat.UPPER_CAMEL;
|
|||
import static com.google.common.reflect.Reflection.getPackageName;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import com.beust.jcommander.Parameters;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.reflect.ClassPath;
|
||||
|
@ -76,6 +77,16 @@ public class RegistryToolTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_commandMap_allCommandsHaveDescriptions() throws Exception {
|
||||
for (Map.Entry<String, ? extends Class<? extends Command>> commandEntry :
|
||||
RegistryTool.COMMAND_MAP.entrySet()) {
|
||||
Parameters parameters = commandEntry.getValue().getAnnotation(Parameters.class);
|
||||
assertThat(parameters).isNotNull();
|
||||
assertThat(parameters.commandDescription()).isNotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the set of all non-abstract classes implementing the {@link Command} interface (abstract
|
||||
* class and interface subtypes of Command aren't expected to have cli commands). Note that this
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue