Ejemplo n.º 1
0
 @Test
 public void shouldKnowIfAGivenDirectoryExists() throws Exception {
   File testFolder = new File("TestFolder");
   testFolder.mkdir();
   updater.parseCommandLine(new String[] {"TestFolder"});
   assertTrue(updater.directoriesAreValid());
   FileUtil.deleteFileSystemDirectory(testFolder);
   assertFalse(updater.directoriesAreValid());
 }
Ejemplo n.º 2
0
 @Test
 public void testMainUnhappyPath() throws Exception {
   String args[] = {"foo", "bar"};
   UpdateFileList updaterMock = mock(UpdateFileList.class);
   UpdateFileList.testUpdater = updaterMock;
   when(updaterMock.directoriesAreValid()).thenReturn(false);
   UpdateFileList.main(args);
   verify(updaterMock).printMessage("Some directories are invalid.");
   verify(updaterMock).exit();
 }
Ejemplo n.º 3
0
 @Test
 public void testMainHappyPath() throws Exception {
   String args[] = {"foo", "bar"};
   UpdateFileList updaterMock = mock(UpdateFileList.class);
   UpdateFileList.testUpdater = updaterMock;
   when(updaterMock.directoriesAreValid()).thenReturn(true);
   UpdateFileList.main(args);
   verify(updaterMock).parseCommandLine(args);
   verify(updaterMock).createUpdateList();
   verify(updaterMock).createDoNotUpdateList();
 }