Ejemplo n.º 1
0
 @Test
 public void testWithoutDecode() throws IOException {
   File testFile = new File(folder.getRoot(), "testFileNoDecode.txt");
   FileUtils.writeStringToFile(testFile, FILEDATA);
   List<Text> output = ShellUtil.scanFile(testFile.getAbsolutePath(), false);
   assertEquals(ImmutableList.of(new Text("line1"), new Text("line2")), output);
 }
Ejemplo n.º 2
0
 @Test
 public void testWithDecode() throws IOException {
   File testFile = new File(folder.getRoot(), "testFileWithDecode.txt");
   FileUtils.writeStringToFile(testFile, FILEDATA);
   List<Text> output = ShellUtil.scanFile(testFile.getAbsolutePath(), true);
   assertEquals(
       ImmutableList.of(
           new Text(Base64.decodeBase64("line1".getBytes(StandardCharsets.UTF_8))),
           new Text(Base64.decodeBase64("line2".getBytes(StandardCharsets.UTF_8)))),
       output);
 }
Ejemplo n.º 3
0
 @Test(expected = FileNotFoundException.class)
 public void testWithMissingFile() throws FileNotFoundException {
   ShellUtil.scanFile("missingFile.txt", false);
 }