+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.api.config;
-
-import org.apache.commons.lang.StringUtils;
-
-import java.util.Locale;
-
-/**
- * @since 3.7
- */
-public class Category {
-
- private final String originalKey;
- private final boolean special;
-
- public Category(String originalKey) {
- this(originalKey, false);
- }
-
- Category(String originalKey, boolean special) {
- this.originalKey = originalKey;
- this.special = special;
- }
-
- public String originalKey() {
- return originalKey;
- }
-
- public String key() {
- return StringUtils.lowerCase(originalKey, Locale.ENGLISH);
- }
-
- public boolean isSpecial() {
- return special;
- }
-
- @Override
- public int hashCode() {
- return key().hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof Category)) {
- return false;
- }
- return StringUtils.equalsIgnoreCase(((Category) obj).originalKey, this.originalKey);
- }
-
- @Override
- public String toString() {
- return this.originalKey;
- }
-
-}
*/
package org.sonar.api.config;
+import org.sonar.api.config.internal.SubCategory;
+
+import org.sonar.api.config.internal.Category;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.api.config;
-
-/**
- * @since 3.7
- */
-public class SubCategory extends Category {
-
- public SubCategory(String originalKey) {
- super(originalKey);
- }
-
- SubCategory(String originalKey, boolean special) {
- super(originalKey, special);
- }
-
-}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.api.config.internal;
+
+import org.apache.commons.lang.StringUtils;
+
+import java.util.Locale;
+
+/**
+ * @since 3.7
+ */
+public class Category {
+
+ private final String originalKey;
+ private final boolean special;
+
+ public Category(String originalKey) {
+ this(originalKey, false);
+ }
+
+ public Category(String originalKey, boolean special) {
+ this.originalKey = originalKey;
+ this.special = special;
+ }
+
+ public String originalKey() {
+ return originalKey;
+ }
+
+ public String key() {
+ return StringUtils.lowerCase(originalKey, Locale.ENGLISH);
+ }
+
+ public boolean isSpecial() {
+ return special;
+ }
+
+ @Override
+ public int hashCode() {
+ return key().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof Category)) {
+ return false;
+ }
+ return StringUtils.equalsIgnoreCase(((Category) obj).originalKey, this.originalKey);
+ }
+
+ @Override
+ public String toString() {
+ return this.originalKey;
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.api.config.internal;
+
+
+/**
+ * @since 3.7
+ */
+public class SubCategory extends Category {
+
+ public SubCategory(String originalKey) {
+ super(originalKey);
+ }
+
+ public SubCategory(String originalKey, boolean special) {
+ super(originalKey, special);
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.api.config.internal;
+
+import javax.annotation.ParametersAreNonnullByDefault;
\ No newline at end of file
+++ /dev/null
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2013 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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 this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.api.config;
-
-import org.junit.Test;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-public class CategoryTest {
-
- @Test
- public void category_key_is_case_insentive() {
- assertThat(new Category("Licenses")).isEqualTo(new Category("licenses"));
- }
-
- @Test
- public void should_preserve_original_key() {
- assertThat(new Category("Licenses").originalKey()).isEqualTo("Licenses");
- }
-}
*/
package org.sonar.api.config;
+import org.sonar.api.config.internal.SubCategory;
+
+import org.sonar.api.config.internal.Category;
import org.junit.Test;
import org.sonar.api.Properties;
import org.sonar.api.Property;
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.api.config.internal;
+
+import org.junit.Test;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+public class CategoryTest {
+
+ @Test
+ public void category_key_is_case_insentive() {
+ assertThat(new Category("Licenses")).isEqualTo(new Category("licenses"));
+
+ // Just to raise coverage
+ assertThat(new Category("Licenses")).isNotEqualTo(new SubCategory("foo"));
+ }
+
+ @Test
+ public void should_preserve_original_key() {
+ assertThat(new Category("Licenses").originalKey()).isEqualTo("Licenses");
+ }
+}
default_category = @categories.empty? ? nil : @categories[0]
@category = default_category
else
- @category = @categories.select {|c| c == Java::OrgSonarApiConfig::Category.new(params[:category])}.first
+ @category = @categories.select {|c| c == Java::OrgSonarApiConfigInternal::Category.new(params[:category])}.first
not_found('category') if @category.nil?
end
((@subcategories_per_categories[@category].include? @category) ? @category : @subcategories_per_categories[@category][0])
@subcategory = default_subcategory
else
- @subcategory = @subcategories_per_categories[@category].select {|s| s == Java::OrgSonarApiConfig::SubCategory.new(params[:subcategory])}.first
+ @subcategory = @subcategories_per_categories[@category].select {|s| s == Java::OrgSonarApiConfigInternal::SubCategory.new(params[:subcategory])}.first
not_found('subcategory') if @subcategory.nil?
end