Skip to content

Commit

Permalink
Update error message and add a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmnbroad committed Mar 12, 2024
1 parent b492efb commit ccdbb90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/picard/util/BedToIntervalList.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public class BedToIntervalList extends CommandLineProgram {
protected int doWork() {
IOUtil.assertFileIsReadable(INPUT);
if(INPUT.getPath().equals("/dev/stdin")) {
throw new IllegalArgumentException("BedToIntervalList cannot read from /dev/stdin.");
throw new IllegalArgumentException("BedToIntervalList does not support reading from standard input - a file must be provided.");
}

IOUtil.assertFileIsReadable(SEQUENCE_DICTIONARY);
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/picard/util/BedToIntervalListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ public void testLengthZeroIntervalsSkipped(final String inputBed) throws IOExcep
doTest(inputBed, "header.sam", false);
}

@Test(expectedExceptions = IllegalArgumentException.class)
public void testRejectStdin() throws IOException {
final BedToIntervalList program = new BedToIntervalList();
final File outputFile = File.createTempFile("bed_to_interval_list_test.", ".interval_list");
outputFile.deleteOnExit();
program.OUTPUT = outputFile;
program.SEQUENCE_DICTIONARY = new File(TEST_DATA_DIR, "header.sam");
program.UNIQUE = true;
program.INPUT = new File("/dev/stdin");
program.doWork();
}

@DataProvider
public Object[][] testBedToIntervalListDataProvider() {
return new Object[][]{
Expand Down

0 comments on commit ccdbb90

Please sign in to comment.