added the missing file to the error message

This commit is contained in:
Yossi Farjoun 2015-04-03 11:13:02 -04:00 committed by Ron Levine
parent 761e456d07
commit d30a6258bc
2 changed files with 66 additions and 6 deletions

View File

@ -428,4 +428,64 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
);
executeTest(String.format("testUnusedAlleleTrimming: (%s,%s)", new File(vcf).getName(), extraArgs), spec);
}
/**
* Test with an empty VCF file
*/
@Test
public void testEmptyVcfException(){
String testfile = privateTestDir + "reallyEmpty.vcf";
WalkerTestSpec spec = new WalkerTestSpec(
"-T SelectVariants" +
" -R " + b36KGReference +
" -V " + testfile +
" -o %s --no_cmdline_in_header",
1,
UserException.CommandLineException.class
);
spec.disableShadowBCF();
executeTest("testEmptyVcfException--" + testfile, spec);
}
/**
* Test with a VCF file that is not a file
*/
@Test
public void testNotFileVcfException(){
String testfile = privateTestDir;
WalkerTestSpec spec = new WalkerTestSpec(
"-T SelectVariants" +
" -R " + b36KGReference +
" -V " + testfile +
" -o %s --no_cmdline_in_header",
1,
UserException.CouldNotReadInputFile.class
);
spec.disableShadowBCF();
executeTest("testNotFileVcfException--" + testfile, spec);
}
/**
* Test with a VCF file that does not exist
*/
@Test
public void testMissingVcfException(){
String testfile = "test.vcf";
WalkerTestSpec spec = new WalkerTestSpec(
"-T SelectVariants" +
" -R " + b36KGReference +
" -V " + testfile +
" -o %s --no_cmdline_in_header",
1,
UserException.CouldNotReadInputFile.class
);
spec.disableShadowBCF();
executeTest("testMissingVcfException--" + testfile, spec);
}
}

View File

@ -26,13 +26,13 @@
package org.broadinstitute.gatk.utils.commandline;
import htsjdk.tribble.AbstractFeatureReader;
import org.apache.log4j.Logger;
import htsjdk.tribble.Feature;
import org.broadinstitute.gatk.utils.refdata.tracks.FeatureManager;
import org.apache.log4j.Logger;
import org.broadinstitute.gatk.utils.classloader.JVMUtils;
import org.broadinstitute.gatk.utils.exceptions.DynamicClassResolutionException;
import org.broadinstitute.gatk.utils.exceptions.ReviewedGATKException;
import org.broadinstitute.gatk.utils.exceptions.UserException;
import org.broadinstitute.gatk.utils.refdata.tracks.FeatureManager;
import org.broadinstitute.gatk.utils.text.XReadLines;
import java.io.File;
@ -396,13 +396,13 @@ public abstract class ArgumentTypeDescriptor {
}
if ( ! file.exists() ) {
throw new UserException.CouldNotReadInputFile(file, "file does not exist");
throw new UserException.CouldNotReadInputFile(file, "file \'"+ file + "\' does not exist");
} else if ( ! file.canRead() || ! file.isFile() ) {
throw new UserException.CouldNotReadInputFile(file, "file could not be read");
throw new UserException.CouldNotReadInputFile(file, "file \'"+ file + "\' could not be read");
} else {
throw new UserException.CommandLineException(
String.format("No tribble type was provided on the command line and the type of the file could not be determined dynamically. " +
"Please add an explicit type tag :NAME listing the correct type from among the supported types:%n%s",
String.format("No tribble type was provided on the command line and the type of the file \'"+ file + "\' could not be determined dynamically. " +
"Please add an explicit type tag :NAME listing the correct type from among the supported types:%n%s",
manager.userFriendlyListOfAvailableFeatures(parameterType)));
}
}