コード例 #1
0
 @Before
 public void inContext() throws Exception {
   altClassDir = new File("altClasses");
   FileUtils.forceMkdir(altClassDir);
   List<File> buildPaths = new ArrayList<File>();
   buildPaths.addAll(fakeBuildPaths());
   buildPaths.add(altClassDir);
   classpath = new StandaloneClasspath(buildPaths);
   detector = new FileChangeDetector();
   detector.setClasspathProvider(classpath);
 }
コード例 #2
0
 @Test
 public void shouldBeTolerantOfDissapearingDirectories() throws Exception {
   detector =
       new FileChangeDetector() {
         @Override
         protected File[] childrenOf(File directory) {
           return null;
         }
       };
   detector.setClasspathProvider(classpath);
   assertEquals(emptySet(), detector.findChangedFiles());
 }
コード例 #3
0
 @Test
 public void shouldDetectChangedFilesByTimeStamp() throws Exception {
   detector =
       new FileChangeDetector() {
         @Override
         protected long getModificationTimestamp(File classFile) {
           return timestamp;
         }
       };
   detector.setClasspathProvider(classpath);
   assertFalse(
       "Should have found changed files on first run", detector.findChangedFiles().isEmpty());
   assertTrue("Timestamp is unchanged", detector.findChangedFiles().isEmpty());
   timestamp += 100;
   assertFalse("Timestamp changed", detector.findChangedFiles().isEmpty());
 }
コード例 #4
0
 @Test
 public void shouldHandleStrangeClasspaths() throws Exception {
   ChangeDetector changeDetector = new FileChangeDetector();
   changeDetector.setClasspathProvider(new StandaloneClasspath(new ArrayList<File>(), ""));
   assertTrue(changeDetector.findChangedFiles().isEmpty());
 }