diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-05-21 00:18:19 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2015-05-21 00:18:19 +0200 |
commit | 93afcd63599ffaf431ec7cc9d513cc175db97324 (patch) | |
tree | 828b8941a7f17a9cd83bad3ed2616e176abc4735 /sonar-java-api/src/test | |
parent | 921963613e862a3749cda659f5a9f8d4813ca13c (diff) | |
download | sonarqube-93afcd63599ffaf431ec7cc9d513cc175db97324.tar.gz sonarqube-93afcd63599ffaf431ec7cc9d513cc175db97324.zip |
Stop maintain deprecated module sonar-java and use version 5.1
Diffstat (limited to 'sonar-java-api/src/test')
3 files changed, 0 insertions, 200 deletions
diff --git a/sonar-java-api/src/test/java/org/sonar/java/api/JavaClassTest.java b/sonar-java-api/src/test/java/org/sonar/java/api/JavaClassTest.java deleted file mode 100644 index ae41e7f88b1..00000000000 --- a/sonar-java-api/src/test/java/org/sonar/java/api/JavaClassTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 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.java.api; - -import org.junit.Test; -import org.sonar.api.resources.Java; -import org.sonar.api.resources.Language; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - -public class JavaClassTest { - - @Test - public void shouldCreateReferenceFromName() { - JavaClass javaClass = JavaClass.create("org.foo.Bar"); - assertThat(javaClass.getClassName(), is("Bar")); - assertThat(javaClass.getKey(), is("org.foo.Bar")); - assertThat(javaClass.getLanguage(), is((Language)Java.INSTANCE)); - assertThat(javaClass.getName(), is("org.foo.Bar")); - assertThat(javaClass.getLongName(), is("org.foo.Bar")); - } - - @Test - public void shouldCreateReferenceFromPackageAndClassname() { - JavaClass javaClass = JavaClass.create("org.foo", "Bar"); - assertThat(javaClass.getClassName(), is("Bar")); - assertThat(javaClass.getKey(), is("org.foo.Bar")); - assertThat(javaClass.getLanguage(), is((Language)Java.INSTANCE)); - assertThat(javaClass.getName(), is("org.foo.Bar")); - assertThat(javaClass.getLongName(), is("org.foo.Bar")); - } - - @Test - public void shouldGetPackageName() { - JavaClass javaClass = JavaClass.create("org.foo.Bar"); - assertThat(javaClass.getPackageName(), is("org.foo")); - - javaClass = JavaClass.create("Bar"); - assertThat(javaClass.getPackageName(), is("")); - } - - @Test - public void shouldGetClassName() { - JavaClass javaClass = JavaClass.create("org.foo.Bar"); - assertThat(javaClass.getClassName(), is("Bar")); - - javaClass = JavaClass.create("Bar"); - assertThat(javaClass.getClassName(), is("Bar")); - } - - @Test - public void shouldOverrideToString() { - JavaClass javaClass = JavaClass.create("org.foo.Bar"); - assertThat(javaClass.toString(), is("org.foo.Bar")); - } - - @Test - public void shouldBuild() { - JavaClass javaClass = new JavaClass.Builder().setName("org.foo", "Bar").setFromLine(30).create(); - assertThat(javaClass.getName(), is("org.foo.Bar")); - assertThat(javaClass.getFromLine(), is(30)); - assertThat(javaClass.getToLine(), is(JavaClass.UNKNOWN_LINE)); - } - - @Test - public void shouldNotBuildWithNegativeNumberOfLine() { - JavaClass javaClass = new JavaClass.Builder().setName("org.foo", "Bar").setFromLine(-30).setToLine(0).create(); - assertThat(javaClass.getFromLine(), is(JavaClass.UNKNOWN_LINE)); - assertThat(javaClass.getToLine(), is(0)); - } -} diff --git a/sonar-java-api/src/test/java/org/sonar/java/api/JavaMethodTest.java b/sonar-java-api/src/test/java/org/sonar/java/api/JavaMethodTest.java deleted file mode 100644 index 1af0256a51a..00000000000 --- a/sonar-java-api/src/test/java/org/sonar/java/api/JavaMethodTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 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.java.api; - -import org.junit.Test; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - -public class JavaMethodTest { - @Test - public void shouldCreateReference() { - String key = "org.foo.Bar#hello(LString;)V"; - JavaMethod method = JavaMethod.createRef(key); - assertThat(method.getKey(), is(key)); - assertThat(method.getClassName(), is("org.foo.Bar")); - assertThat(method.getLongName(), is(key)); - assertThat(method.getName(), is("hello(LString;)V")); - assertThat(method.getSignature(), is("hello(LString;)V")); - } - - @Test - public void shouldCreateReferenceFromClassAndSignature() { - String className = "org.foo.Bar"; - String signature = "hello(LString;)V"; - JavaMethod method = JavaMethod.createRef(JavaClass.create(className), signature); - assertThat(method.getKey(), is(className + "#" + signature)); - assertThat(method.getClassName(), is(className)); - assertThat(method.getName(), is(signature)); - assertThat(method.getSignature(), is(signature)); - } -} diff --git a/sonar-java-api/src/test/java/org/sonar/java/api/JavaUtilsTest.java b/sonar-java-api/src/test/java/org/sonar/java/api/JavaUtilsTest.java deleted file mode 100644 index 1c2eb29753b..00000000000 --- a/sonar-java-api/src/test/java/org/sonar/java/api/JavaUtilsTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2014 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.java.api; - -import org.junit.Test; -import org.sonar.api.config.Settings; -import org.sonar.api.resources.Project; - -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; - -public class JavaUtilsTest { - - @Test - public void shouldAbbreviatePackage() { - assertThat(JavaUtils.abbreviatePackage(""), is("")); - assertThat(JavaUtils.abbreviatePackage("com"), is("com")); - assertThat(JavaUtils.abbreviatePackage("com.foo"), is("com.f")); - assertThat(JavaUtils.abbreviatePackage("com.foo.bar.buz"), is("com.f.b.b")); - assertThat(JavaUtils.abbreviatePackage("..."), is("")); - assertThat(JavaUtils.abbreviatePackage("com.foo."), is("com.f")); - assertThat(JavaUtils.abbreviatePackage("com.foo..bar"), is("com.f.b")); - } - - @Test - public void shouldReturnDefaultJavaVersion() { - Settings configuration = new Settings(); - Project project = new Project("").setSettings(configuration); - - assertThat(JavaUtils.getSourceVersion(project), is("1.5")); - assertThat(JavaUtils.getTargetVersion(project), is("1.5")); - } - - @Test - public void shouldReturnSpecifiedJavaVersion() { - Settings configuration = new Settings(); - Project project = new Project("").setSettings(configuration); - configuration.setProperty(JavaUtils.JAVA_SOURCE_PROPERTY, "1.4"); - configuration.setProperty(JavaUtils.JAVA_TARGET_PROPERTY, "1.6"); - - assertThat(JavaUtils.getSourceVersion(project), is("1.4")); - assertThat(JavaUtils.getTargetVersion(project), is("1.6")); - } - -} |