### Question:
FileReadInp extends AbstractIRODSPackingInstruction { public static final FileReadInp instanceForReadStream(final int fileDescriptor, final long length) throws JargonException { return new FileReadInp(FILE_READ_API_NBR, fileDescriptor, length); } private  FileReadInp(final int apiNumber, final int fileDescriptor, final long length); static final FileReadInp instanceForReadStream(final int fileDescriptor, final long length); @Override Tag getTagValue(); static final String PI_TAG; static final int FILE_READ_API_NBR; static final String FILE_INX; static final String LEN; }### Answer:
@Test public final void testInstance() throws Exception { int fd = 2; long length = 100L; FileReadInp fileReadInp = FileReadInp.instanceForReadStream(fd, length); Assert.assertNotNull("null fileReadInp", fileReadInp); Assert.assertEquals("wrong API num", FileReadInp.FILE_READ_API_NBR, fileReadInp.getApiNumber()); }
@Test(expected = IllegalArgumentException.class) public final void testInstanceZeroFd() throws Exception { FileReadInp.instanceForReadStream(0, 100); }
@Test(expected = IllegalArgumentException.class) public final void testInstanceNegFd() throws Exception { FileReadInp.instanceForReadStream(-1, 100); }
@Test(expected = IllegalArgumentException.class) public final void testInstanceZeroLen() throws Exception { FileReadInp.instanceForReadStream(10, 0); }
@Test(expected = IllegalArgumentException.class) public final void testInstanceNegLen() throws Exception { FileReadInp.instanceForReadStream(10, -1); }
@Test public final void testGetParsedTagsForReadStream() throws Exception { StringBuilder sb = new StringBuilder(); sb.append("<fileReadInp_PI><fileInx>2</fileInx>\n"); sb.append("<len>100</len>\n"); sb.append("</fileReadInp_PI>\n"); String expected = sb.toString(); int fd = 2; long length = 100L; FileReadInp fileReadInp = FileReadInp.instanceForReadStream(fd, length); Assert.assertEquals("did not get expected xml", expected, fileReadInp.getParsedTags()); }