Exemplo n.º 1
0
  @Test
  public void testCompare() {
    try {
      File file = new File(dataRoot, "file/a.txt");
      FileInputStream in1 = new FileInputStream(file);

      String content = "test file\r\n";
      if (file.length() == 10) {
        content = StringUtil.remove(content, '\r');
      }
      AsciiInputStream in2 = new AsciiInputStream(content);
      assertTrue(StreamUtil.compare(in1, in2));
      StreamUtil.close(in2);
      StreamUtil.close(in1);
    } catch (FileNotFoundException e) {
      fail("StreamUtil.testCloneCompare " + e.toString());
    } catch (IOException e) {
      fail("StreamUtil.testCloneCompare " + e.toString());
    }
  }