LicensesLocator { @NotNull public List<Path> getLicenseFiles() { List<Path> licenses = new ArrayList<>(); licenses.addAll(getIdeLicenseAndNotice()); licenses.addAll(getIdeWideThirdPartyLibLicenses()); for (String plugin : myGooglePlugins) { licenses.addAll(getThirdPartyLibrariesForPlugin(plugin)); } return licenses; } LicensesLocator(@NotNull Path ideHome, boolean isMacLayout); @NotNull List<Path> getLicenseFiles();  }
@Test public void linuxOrWindowsLayout() throws Exception { Path testRoot = Paths.get(AndroidTestBase.getTestDataPath(), "licenseLocator"); Path ideHome = testRoot.resolve("linux"); LicensesLocator locator = new LicensesLocator(ideHome, false); List<String> expectedPaths = Arrays.asList( "LICENSE.txt", "NOTICE.txt", "license/ant_license.txt", "plugins/android/lib/licenses/antlr4-runtime-4.5.3.jar-NOTICE", "plugins/android/lib/licenses/asm-5.0.3-NOTICE" ); assertThat(relativize(locator.getLicenseFiles(), ideHome)).containsAllIn(expectedPaths); }
@Test public void macLayout() throws Exception { Path testRoot = Paths.get(AndroidTestBase.getTestDataPath(), "licenseLocator"); Path ideHome = testRoot.resolve("mac/Contents"); LicensesLocator locator = new LicensesLocator(ideHome, true); List<String> expectedPaths = Arrays.asList( "Resources/LICENSE.txt", "Resources/NOTICE.txt", "license/ant_license.txt", "plugins/android/lib/licenses/antlr4-runtime-4.5.3.jar-NOTICE", "plugins/android/lib/licenses/asm-5.0.3-NOTICE" ); assertThat(relativize(locator.getLicenseFiles(), ideHome)).containsAllIn(expectedPaths); }