Cleaner { public void clean() { cleanDir(new File(config.getOutputDir()), false); } @Autowired  Cleaner(RegisterConfig config,
        @Value("${service.registry.entry.max.live:43200000}") int maxLive); @PostConstruct void deleteOldFilesAfterEachStartup(); void clean();  }
@Test public void testClean() { writer.register(entry.withTime(new Date(System.currentTimeMillis() - 2000))); cleaner.clean(); List<RegisterEntry> list = finder.find(Optional.empty()); assertThat(list.size(), equalTo(0)); }