    @Test
    public void profileAndRoot_switchScopeOnReferencedExistingProvidedScopeDep()
        throws Exception
    {

        final Location location = new SimpleLocation( "test-repo", "http://www.nowhere.com/path/to/repo" );
        final ProjectVersionRef pvr = new SimpleProjectVersionRef( "group.id", "artifact-id", "1" );

        final String pom = BASE + "in-profile-root-provided-dep.pom.xml";
        final TestDownload download = new TestDownload( pom );

        final ConcreteResource resource =
            new ConcreteResource( location, ArtifactPathUtils.formatArtifactPath( pvr.asPomArtifact(),
                                                                                  galleyFixture.getMapper() ) );

        galleyFixture.getTransport()
                     .registerDownload( resource, download );

        final URI src = new URI( "test:uri" );
        final DiscoveryResult result =
            new DiscoveryResult( src, pvr, parseDependencyRelationships( pom, pvr, location, src ) );
        final Set<ProjectRelationship<?, ?>> oldRels = result.getAcceptedRelationships();

        patcher.patch( result, Collections.singletonList( location ), getContext( pvr, location ) );

        final Set<ProjectRelationship<?, ?>> newRels = result.getAcceptedRelationships();
        newRels.removeAll( oldRels );

        assertThat( newRels, notNullValue() );
        assertThat( newRels.size(), equalTo( 0 ) );

        for ( final ProjectRelationship<?, ?> rel : result.getAcceptedRelationships() )
        {
            assertThat( rel + " is not a dependency!", rel instanceof DependencyRelationship, equalTo( true ) );
            assertThat( rel + " is not of scope embedded!", ( (DependencyRelationship) rel ).getScope(),
                        equalTo( DependencyScope.embedded ) );
            assertThat( rel + " is not declared in the pom root!", rel.getPomLocation(),
                        equalTo( POM_ROOT_URI ) );
        }
    }