From 24b4f7b1a15e64b1cae55e773cb19f878f629618 Mon Sep 17 00:00:00 2001 From: Chris Norman Date: Mon, 11 Jun 2018 12:46:05 -0400 Subject: [PATCH] Fix getAllowedValuesForDescriptorHelp in GATKAnnotationPluginDescriptor.java. (#4876) --- .../GATKPlugin/GATKAnnotationPluginDescriptor.java | 4 ++-- .../hellbender/engine/GATKToolUnitTest.java | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/broadinstitute/hellbender/cmdline/GATKPlugin/GATKAnnotationPluginDescriptor.java b/src/main/java/org/broadinstitute/hellbender/cmdline/GATKPlugin/GATKAnnotationPluginDescriptor.java index e527afe467f..47da60749e5 100644 --- a/src/main/java/org/broadinstitute/hellbender/cmdline/GATKPlugin/GATKAnnotationPluginDescriptor.java +++ b/src/main/java/org/broadinstitute/hellbender/cmdline/GATKPlugin/GATKAnnotationPluginDescriptor.java @@ -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 getAllowedValuesForDescriptorHelp(String longArgName) { @@ -243,7 +243,7 @@ public Set 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 diff --git a/src/test/java/org/broadinstitute/hellbender/engine/GATKToolUnitTest.java b/src/test/java/org/broadinstitute/hellbender/engine/GATKToolUnitTest.java index 959e5cf1c10..e064281b9a9 100644 --- a/src/test/java/org/broadinstitute/hellbender/engine/GATKToolUnitTest.java +++ b/src/test/java/org/broadinstitute/hellbender/engine/GATKToolUnitTest.java @@ -621,11 +621,6 @@ public void testCreateVCFWriterDefaults( Assert.assertFalse(outFileMD5.exists(), "An md5 file was created and should not have been"); } - private List instantiateAnnotations(final CommandLineParser clp) { - GATKAnnotationPluginDescriptor annotationPlugin = clp.getPluginDescriptor(GATKAnnotationPluginDescriptor.class); - return annotationPlugin.getResolvedInstances(); - } - @Test public void testMakeEmptyAnnotations() { final TestGATKToolWithVariants tool = createTestVariantTool(null); @@ -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); }