aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/test/java/org
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-05-22 15:57:09 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2012-05-22 15:57:44 +0200
commit46f29bf155f83821ec2931d5230b6df78e429429 (patch)
treeb22d59387ba3c8e43b441bcc54c7a5231a4b1e33 /sonar-plugin-api/src/test/java/org
parent777d9010c1f88229730db03e1e8636a39a207645 (diff)
downloadsonarqube-46f29bf155f83821ec2931d5230b6df78e429429.tar.gz
sonarqube-46f29bf155f83821ec2931d5230b6df78e429429.zip
SONAR-2706 Delete unused classes in API
Diffstat (limited to 'sonar-plugin-api/src/test/java/org')
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/reviews/ReviewContextTest.java70
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/test/ReviewContextTestUtils.java47
2 files changed, 0 insertions, 117 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/reviews/ReviewContextTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/reviews/ReviewContextTest.java
deleted file mode 100644
index 39cba447272..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/reviews/ReviewContextTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.api.reviews;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.sonar.api.test.ReviewContextTestUtils;
-
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-public class ReviewContextTest {
-
- private ReviewContext reviewContext;
-
- @Before
- public void init() {
- reviewContext = ReviewContextTestUtils.createReviewContext("review={id=45, status=RESOLVED}; project={id=12}; user={login=admin}; params={comment=This is a comment}");
- }
-
- @Test
- public void shouldGetReviewProps() {
- assertThat(reviewContext.getReviewProperty("id"), is("45"));
- assertThat(reviewContext.getReviewProperty("status"), is("RESOLVED"));
- assertThat(reviewContext.getReviewProperty("assignee"), is(nullValue()));
- }
-
- @Test
- public void shouldGetProjectProps() {
- assertThat(reviewContext.getProjectProperty("id"), is("12"));
- }
-
- @Test
- public void shouldGetUserProps() {
- assertThat(reviewContext.getUserProperty("login"), is("admin"));
- }
-
- @Test
- public void shouldGetParams() {
- assertThat(reviewContext.getParamValue("comment"), is("This is a comment"));
- }
-
- @Test
- public void testEmptyReviewContext() throws Exception {
- reviewContext = ReviewContextTestUtils.createReviewContext("");
- assertThat(reviewContext.getReviewProperty("id"), is(nullValue()));
- assertThat(reviewContext.getProjectProperty("id"), is(nullValue()));
- assertThat(reviewContext.getUserProperty("login"), is(nullValue()));
- assertThat(reviewContext.getParamValue("comment"), is(nullValue()));
- }
-
-}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/test/ReviewContextTestUtils.java b/sonar-plugin-api/src/test/java/org/sonar/api/test/ReviewContextTestUtils.java
deleted file mode 100644
index 12ded136423..00000000000
--- a/sonar-plugin-api/src/test/java/org/sonar/api/test/ReviewContextTestUtils.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.api.test;
-
-import com.google.common.collect.Maps;
-import org.apache.commons.lang.StringUtils;
-import org.sonar.api.reviews.ReviewContext;
-
-import java.util.Map;
-
-public class ReviewContextTestUtils {
-
- public static ReviewContext createReviewContext(String properties) {
- Map<String, Map<String, String>> reviewContextMap = Maps.newLinkedHashMap();
- for (String innerMap : StringUtils.split(properties, ';')) {
- if (StringUtils.isNotBlank(innerMap)) {
- String mapName = StringUtils.substringBefore(innerMap, "=").trim();
- Map<String, String> currentMap = Maps.newLinkedHashMap();
- for (String keyValuePairList : StringUtils.substringsBetween(innerMap, "{", "}")) {
- for (String keyValuePair : StringUtils.split(keyValuePairList, ',')) {
- currentMap.put(StringUtils.substringBefore(keyValuePair, "=").trim(), StringUtils.substringAfter(keyValuePair, "=").trim());
- }
- }
- reviewContextMap.put(mapName, currentMap);
- }
- }
-
- return ReviewContext.createFromMap(reviewContextMap);
- }
-}