### Question:
WebHookTeamCityRestApiZipPluginFixer { protected List<Path> findRestApiZipFileInTomcatDir(File tomcatDir, String filepattern) throws IOException { Finder finder = new Finder(filepattern); Files.walkFileTree(tomcatDir.toPath(), finder); return finder.getResults(); } WebHookTeamCityRestApiZipPluginFixer(SBuildServer sBuildServer); List<Path> getFoundApiZipFilesContainingJaxbJars(); boolean foundApiZipFilesContainingJaxbJars(); synchronized void findRestApiZipPlugins(); synchronized JarReport fixRestApiZipPlugin(Path p); static final String UNPACKED_LOCATION; }### Answer:
@Test public void testFindRestApiZipFileInTeamCityDir() throws IOException { when(sBuildServer.getServerRootPath()).thenReturn("src/test/resources/catalina_home/webapps/ROOT"); WebHookTeamCityRestApiZipPluginFixer fixer = new WebHookTeamCityRestApiZipPluginFixer(sBuildServer); List<Path> filesFound = fixer.findRestApiZipFileInTomcatDir(new File("src/test/resources/catalina_home"), "somefile.zip"); assertEquals(1, filesFound.size()); String path = "src/test/resources/catalina_home/webapps/ROOT/WEB-INF/plugins/somefile.zip"; assertTrue(path.equals(filesFound.get(0).toString()) || path.replace("/","\\").equals(filesFound.get(0).toString())); }
@Test public void testFindRestApiZipFileInTomcatDir() throws IOException { when(sBuildServer.getServerRootPath()).thenReturn("src/test/resources/empty_teamcity_home/webapps/ROOT"); WebHookTeamCityRestApiZipPluginFixer fixer = new WebHookTeamCityRestApiZipPluginFixer(sBuildServer); List<Path> filesFound = fixer.findRestApiZipFileInTomcatDir(new File("src/test/resources/catalina_home"), "somefile.zip"); assertEquals(1, filesFound.size()); String path = "src/test/resources/catalina_home/webapps/ROOT/WEB-INF/plugins/somefile.zip"; assertTrue(path.equals(filesFound.get(0).toString()) || path.replace("/","\\").equals(filesFound.get(0).toString())); }