Aether { public Collection<RemoteRepository> getRepositories() { return repositories; } Aether( MavenProject mavenProject ); private  Aether( Settings settings, MavenProject mavenProject ); static synchronized Aether getAether(); RepositorySystem getSystem(); RepositorySystemSession getSession(); Collection<RemoteRepository> getRepositories(); RemoteRepository getLocalRepository(); static Aether instance; }
@Test public void testForcedOffline() { final RemoteRepository central = new RemoteRepository.Builder( "central", "default", "http: final MavenProject mavenProject = mock(MavenProject.class); when(mavenProject.getRemoteProjectRepositories()).thenReturn(Collections.singletonList(central)); final Aether aether = new Aether(mavenProject) { @Override boolean isForcedOffline() { return true; } }; assertThat(aether.getRepositories()).doesNotContain(central); }
@Test public void testNotOffline() { final RemoteRepository central = new RemoteRepository.Builder( "central", "default", "http: final MavenProject mavenProject = mock(MavenProject.class); when(mavenProject.getRemoteProjectRepositories()).thenReturn(Collections.singletonList(central)); final Aether aether = new Aether(mavenProject) { @Override boolean isForcedOffline() { return false; } }; assertThat(aether.getRepositories()).contains(central); }