@Test(groups = {"fast-unit"}) public void should_bePossibleToGetPathToFile_with_fileName() { File file = createFile(); Path expected = putter.getPathForFile(file); Path actual = putter.getPathForFileName(file.getName()); assertEquals(actual, expected); }
@Test(groups = {"fast-unit"}) public void after_putFile_then_deleteMyFiles_should_removeTheDirectory_where_thisClassPutFilesOnTheFileSystem() throws IOException { Path myFiles = putter.getPathOfMyFiles(); putter.putFile(createFile()); assertTrue(fileSystem.exists(myFiles)); putter.deleteMyFiles(); assertFalse(fileSystem.exists(myFiles)); }
@Test( groups = {"fast-unit"}, expectedExceptions = LocalFileNotFound.class) public void copyingFileThatDoesntExist_should_throw_LocalFileNotFound() { File nonExistingFile = new File("file-does-not-exist"); putter.putFile(nonExistingFile); }
@Test(groups = {"fast-unit"}) public void path_where_localFileIsPut_should_differForDifferentFiles() { File file1 = createFile(); File file2 = createFile(); assertTrue(!file1.getAbsolutePath().equals(file2.getAbsolutePath())); Path path1 = putter.getPathForFile(file1); Path path2 = putter.getPathForFile(file2); assertTrue(!path1.equals(path2)); }
@Test(groups = {"fast-unit"}) public void should_bePossibleToGetTheDirectory_where_allThisTestCasesFilesAreStored() { assertNotNull(putter.getPathOfMyFiles()); }
@Test(groups = {"fast-unit"}) public void fileThatIsNotCopied_shouldNot_existInFileSystem() { assertFalse(putter.isFileCopiedToFileSystem(new File("somefile"))); }
@Test(groups = {"fast-unit"}) public void copyingFileThatExists_should_existInFileSystemCopiedTo() throws IOException { File tempFile = createFile(); putter.putFile(tempFile); assertTrue(putter.isFileCopiedToFileSystem(tempFile)); }
@AfterMethod(groups = {"fast-unit"}) public void tearDown() { putter.deleteMyFiles(); }
@BeforeMethod(groups = {"fast-unit"}) public void setUp() { fileSystem = TUtilsFileSystem.getLocalFileSystem(); putter = HadoopFileSystemPutter.create(fileSystem); }
@Test(groups = {"fast-unit"}) public void should_beAbleToGetPath_where_fileIsPut() { assertNotNull(putter.getPathForFile(createFile())); }