### Question:
MavenRepositories { public static List<RemoteRepository> getRemoteRepositories(MavenContainer container, Settings settings) { Set<RemoteRepository> remoteRepos = new HashSet<>(); remoteRepos.addAll(container.getEnabledRepositoriesFromProfile(settings)); String centralRepoURL = getCentralMirrorURL(settings).orElse(MAVEN_CENTRAL_REPO); remoteRepos.add(convertToMavenRepo("central", centralRepoURL, settings)); return new ArrayList<>(remoteRepos); }  static List<RemoteRepository> getRemoteRepositories(MavenContainer container, Settings settings);  }### Answer:
@Test public void testMirrorCentralWithoutProfiles() throws Exception { SettingsBuilder settingsBuilder = new DefaultSettingsBuilderFactory().newInstance(); SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest(); settingsRequest.setUserSettingsFile(new File("src/test/resources/profiles/mirror-settings.xml")); Settings settings = settingsBuilder.build(settingsRequest).getEffectiveSettings(); MavenContainer container = new MavenContainer(); List<RemoteRepository> remoteRepositories = MavenRepositories.getRemoteRepositories(container, settings); Assert.assertThat(remoteRepositories.size(), equalTo(1)); Assert.assertThat(remoteRepositories.get(0).getId(), equalTo("central")); Assert.assertThat(remoteRepositories.get(0).getUrl(), equalTo("http: }
@Test public void testCentralWithProfiles() throws Exception { SettingsBuilder settingsBuilder = new DefaultSettingsBuilderFactory().newInstance(); SettingsBuildingRequest settingsRequest = new DefaultSettingsBuildingRequest(); settingsRequest.setUserSettingsFile(new File("src/test/resources/profiles/settings.xml")); Settings settings = settingsBuilder.build(settingsRequest).getEffectiveSettings(); MavenContainer container = new MavenContainer(); List<RemoteRepository> remoteRepositories = MavenRepositories.getRemoteRepositories(container, settings); Assert.assertEquals(2, remoteRepositories.size()); Assert.assertEquals("test-repository", remoteRepositories.get(1).getId()); List<RemoteRepository> centralRepos = remoteRepositories.stream().filter(repo -> repo.getId().equals("central")).collect(Collectors.toList()); Assert.assertEquals(1, centralRepos.size()); Assert.assertEquals(MavenRepositories.MAVEN_CENTRAL_REPO, centralRepos.get(0).getUrl()); }