@Test
public void testExternalRepositories() {

    String oldSettingsXmlPath = System.getProperty( CUSTOM_SETTINGS_PROPERTY );
    try {
        if (oldSettingsXmlPath != null) {
            System.clearProperty( CUSTOM_SETTINGS_PROPERTY );
        }
        MavenSettings.reinitSettingsFromString( EMPTY_SETTINGS );
        final MavenRequest mavenRequest = createMavenRequest( null );
        final MavenEmbedder embedder = new MavenEmbedderWithRepoMock( mavenRequest );
        final MavenExecutionRequest request = embedder.getMavenExecutionRequest();
        assertNotNull( request );
        final List<ArtifactRepository> remoteRepositories = request.getRemoteRepositories();
        assertEquals( 2,
                      remoteRepositories.size() );
        for ( ArtifactRepository remoteRepository : remoteRepositories ) {
            assertTrue( remoteRepository.getId().equals( "central" )
                                || remoteRepository.getId().equals( "kie-wb-m2-repo" ) );
        }
    } catch ( MavenEmbedderException mee ) {
        fail( mee.getMessage() );
    } finally {
        if (oldSettingsXmlPath != null) {
            System.setProperty( CUSTOM_SETTINGS_PROPERTY, oldSettingsXmlPath );
        }
        MavenSettings.reinitSettings();
    }
}