diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2022-02-01 15:16:25 -0600 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-02-22 20:02:46 +0000 |
commit | 60c1a4038e041a342dda9810e6fd761d66b01bdb (patch) | |
tree | 0e76b4252e4d7d257cf4ddcb6f081996bb1e03ab /server/sonar-auth-gitlab | |
parent | 9694d4113bf401b84e86e0223dbea8f5339388d8 (diff) | |
download | sonarqube-60c1a4038e041a342dda9810e6fd761d66b01bdb.tar.gz sonarqube-60c1a4038e041a342dda9810e6fd761d66b01bdb.zip |
SONAR-15994 Migrate Sonarqube IOC framework from Pico to Spring
Diffstat (limited to 'server/sonar-auth-gitlab')
-rw-r--r-- | server/sonar-auth-gitlab/src/test/java/org/sonar/auth/gitlab/GitLabModuleTest.java | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/server/sonar-auth-gitlab/src/test/java/org/sonar/auth/gitlab/GitLabModuleTest.java b/server/sonar-auth-gitlab/src/test/java/org/sonar/auth/gitlab/GitLabModuleTest.java index 5139aa62c72..1e4cff031d1 100644 --- a/server/sonar-auth-gitlab/src/test/java/org/sonar/auth/gitlab/GitLabModuleTest.java +++ b/server/sonar-auth-gitlab/src/test/java/org/sonar/auth/gitlab/GitLabModuleTest.java @@ -19,19 +19,54 @@ */ package org.sonar.auth.gitlab; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; import org.junit.Test; -import org.sonar.core.platform.ComponentContainer; +import org.sonar.core.platform.Container; +import static java.util.Collections.unmodifiableList; import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER; public class GitLabModuleTest { - @Test public void verify_count_of_added_components() { - ComponentContainer container = new ComponentContainer(); + ListContainer container = new ListContainer(); new GitLabModule().configure(container); - assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 10); + assertThat(container.getAddedObjects()).hasSize(10); } + private static class ListContainer implements Container { + private final List<Object> objects = new ArrayList<>(); + + @Override + public Container add(Object... objects) { + this.objects.add(objects); + return this; + } + + public List<Object> getAddedObjects() { + return unmodifiableList(new ArrayList<>(objects)); + } + + @Override + public <T> T getComponentByType(Class<T> type) { + throw new UnsupportedOperationException(); + } + + @Override + public <T> Optional<T> getOptionalComponentByType(Class<T> type) { + throw new UnsupportedOperationException(); + } + + @Override + public <T> List<T> getComponentsByType(Class<T> type) { + throw new UnsupportedOperationException(); + } + + @Override + public Container getParent() { + throw new UnsupportedOperationException(); + } + } } |