@Test
public void testSendPartialData() throws IOException, InterruptedException {

  FSInputStream in = new MockFSInputStream();
  ByteArrayOutputStream os = new ByteArrayOutputStream();
  // test if multiple ranges, then 416
  { 
    List<InclusiveByteRange> ranges = strToRanges("0-,10-300", 500);
    MockHttpServletResponse response = new MockHttpServletResponse();
    StreamFile.sendPartialData(in, os, response, 500, ranges);
    assertEquals("Multiple ranges should result in a 416 error",
                 416, response.getStatus());
  }
                            
  // test if no ranges, then 416
  { 
    os.reset();
    MockHttpServletResponse response = new MockHttpServletResponse();
    StreamFile.sendPartialData(in, os, response, 500, null);
    assertEquals("No ranges should result in a 416 error",
                 416, response.getStatus());
  }
  // test if invalid single range (out of bounds), then 416
  { 
    List<InclusiveByteRange> ranges = strToRanges("600-800", 500);
    MockHttpServletResponse response = new MockHttpServletResponse();
    StreamFile.sendPartialData(in, os, response, 500, ranges);
    assertEquals("Single (but invalid) range should result in a 416",
                 416, response.getStatus());
  }
    
  // test if one (valid) range, then 206
  { 
    List<InclusiveByteRange> ranges = strToRanges("100-300", 500);
    MockHttpServletResponse response = new MockHttpServletResponse();
    StreamFile.sendPartialData(in, os, response, 500, ranges);
    assertEquals("Single (valid) range should result in a 206",
                 206, response.getStatus());
    assertArrayEquals("Byte range from 100-300",
                      getOutputArray(100, 201),
                      os.toByteArray());
  }
  
}