@Test
public void shouldGiveNewIndependentRepositories() throws NoSuchFieldException, IllegalAccessException {
// given
final String initialId = "id";
RemoteRepository remoteRepository = new RemoteRepository.Builder(initialId, "type", "url").build();
final MavenModelResolver mavenModelResolver = new MavenModelResolver(new MavenRepositorySystem(), null,
Arrays.asList(remoteRepository));
// when
final MavenModelResolver mavenModelResolverCopy = (MavenModelResolver) mavenModelResolver.newCopy();
remoteRepository = new RemoteRepository.Builder(remoteRepository).setId("otherId").build();
// then
// simulate access to repositories field, internal functions uses this field, e.g. to resolve model
final Field repositoriesField = MavenModelResolver.class.getDeclaredField("repositories");