diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2012-01-18 16:23:09 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2012-01-18 16:46:18 +0400 |
commit | 6b2b041383ff5cded872faa0828219b81485fd4d (patch) | |
tree | 6da761a08a178457f199efe23b3282b063c6e083 /sonar-server/src/test/java | |
parent | cf0426185f6b1048e83656e9a43caebfc783058f (diff) | |
download | sonarqube-6b2b041383ff5cded872faa0828219b81485fd4d.tar.gz sonarqube-6b2b041383ff5cded872faa0828219b81485fd4d.zip |
SONAR-3179 Add API to define resources
Diffstat (limited to 'sonar-server/src/test/java')
-rw-r--r-- | sonar-server/src/test/java/org/sonar/server/ui/ResourceDefinitionRepositoryTest.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/sonar-server/src/test/java/org/sonar/server/ui/ResourceDefinitionRepositoryTest.java b/sonar-server/src/test/java/org/sonar/server/ui/ResourceDefinitionRepositoryTest.java new file mode 100644 index 00000000000..a182f96b2ae --- /dev/null +++ b/sonar-server/src/test/java/org/sonar/server/ui/ResourceDefinitionRepositoryTest.java @@ -0,0 +1,40 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2008-2012 SonarSource + * mailto:contact AT sonarsource DOT com + * + * Sonar is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * Sonar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Sonar; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.server.ui; + +import org.junit.Test; +import org.sonar.api.resources.ResourceDefinition; + +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.assertThat; + +public class ResourceDefinitionRepositoryTest { + + @Test + public void test() { + ResourceDefinition def1 = ResourceDefinition.builder("1").build(); + ResourceDefinition def2 = ResourceDefinition.builder("2").build(); + ResourceDefinitionRepository repository = new ResourceDefinitionRepository(new ResourceDefinition[] {def1, def2}); + assertThat(repository.getAll(), hasItems(def1, def2)); + assertThat(repository.get("1"), is(def1)); + assertThat(repository.get("unknown"), notNullValue()); + } + +} |