Esempio 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);
 }
Esempio 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);
 }
Esempio n. 3
0
 @Test(expected = FileNotFoundException.class)
 public void testWithMissingFile() throws FileNotFoundException {
   ShellUtil.scanFile("missingFile.txt", false);
 }