void () { String ubuntuName = "Ubuntu"; String lowerCaseUbuntuName = StringUtil.toLowerCase(ubuntuName); String debianName = "Debian"; ServiceContainerUtil.replaceService( ApplicationManager.getApplication(), WslDistributionManager.class, new WslDistributionManager() { @Override protected @NotNull List<String> loadInstalledDistributionMsIds() { return List.of(ubuntuName, debianName); } @Override public @NotNull List<WslDistributionAndVersion> loadInstalledDistributionsWithVersions() { return ContainerUtil.map(loadInstalledDistributionMsIds(), s -> new WslDistributionAndVersion(s, 2)); } @Override protected boolean isAvailable() { return true; } @Override protected boolean isWslExeSupported() { return true; } }, myTestFixtureRule.getFixture().getTestRootDisposable()); WslDistributionManager distributionManager = WslDistributionManager.getInstance(); WSLDistribution lowerCaseUbuntu = distributionManager.getOrCreateDistributionByMsId(lowerCaseUbuntuName); assertEquals(lowerCaseUbuntuName, lowerCaseUbuntu.getMsId()); WSLDistribution debian = distributionManager.getOrCreateDistributionByMsId(debianName); assertEquals(debianName, debian.getMsId()); // Load the installed distributions to replace previously created distributions with different case. distributionManager.getInstalledDistributions(); assertEquals(ubuntuName, distributionManager.getOrCreateDistributionByMsId(lowerCaseUbuntuName).getMsId()); assertEquals(debianName, distributionManager.getOrCreateDistributionByMsId(debianName).getMsId()); }