Skip to content

Commit

Permalink
Fix getAllowedValuesForDescriptorHelp in GATKAnnotationPluginDescript…
Browse files Browse the repository at this point in the history
…or.java. (#4876)
  • Loading branch information
cmnbroad authored and droazen committed Jun 11, 2018
1 parent 1a7b0b7 commit 24b4f7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private void populateAnnotationGroups(final String simpleName, final Annotation
* Return the allowed values for annotationNames/disableAnnotations/annotationGroups for use by the help system.
*
* @param longArgName long name of the argument for which help is requested
* @return
* @return the set of allowed values for the argument, or null if the argument is not controlled by this descriptor
*/
@Override
public Set<String> getAllowedValuesForDescriptorHelp(String longArgName) {
Expand All @@ -243,7 +243,7 @@ public Set<String> getAllowedValuesForDescriptorHelp(String longArgName) {
if (longArgName.equals(StandardArgumentDefinitions.ANNOTATION_GROUP_LONG_NAME)) {
return discoveredGroups.keySet();
}
throw new IllegalArgumentException("Allowed values request for unrecognized string argument: " + longArgName);
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,11 +621,6 @@ public void testCreateVCFWriterDefaults(
Assert.assertFalse(outFileMD5.exists(), "An md5 file was created and should not have been");
}

private List<Annotation> instantiateAnnotations(final CommandLineParser clp) {
GATKAnnotationPluginDescriptor annotationPlugin = clp.getPluginDescriptor(GATKAnnotationPluginDescriptor.class);
return annotationPlugin.getResolvedInstances();
}

@Test
public void testMakeEmptyAnnotations() {
final TestGATKToolWithVariants tool = createTestVariantTool(null);
Expand Down Expand Up @@ -755,6 +750,14 @@ public void testClearDefaultAnnotations() {
Assert.assertFalse(annots.stream().anyMatch(a -> a.getClass()==ClippingRankSumTest.class));
}

@Test
public void testHelpWithAllPluginDescriptors() {
// Smoke test to ensure that requesting help from plugin descriptors doesn't crash. Use a tool
// (TestGATKToolWithVariants) that has both the read filter and annotation plugin descriptors enabled.
String[] args = {"-h"};
new TestGATKToolWithVariants().instanceMain(args);
}

private TestGATKToolWithVariants createTestVariantTool(final String args[]) {
return createTestVariantTool(new TestGATKToolWithVariants(), args);
}
Expand Down

0 comments on commit 24b4f7b

Please sign in to comment.