diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-09-30 00:07:03 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-09-30 00:07:03 +0200 |
commit | c6dab978b4e06918c7b96684a06c50c8aca74315 (patch) | |
tree | d16b803b094b8984ad722d87ae23d709da37f9df /sonar-testing-harness/src/test/java/org | |
parent | 73e2ceadeb3d0f44d3a96a07947e26531c409053 (diff) | |
download | sonarqube-c6dab978b4e06918c7b96684a06c50c8aca74315.tar.gz sonarqube-c6dab978b4e06918c7b96684a06c50c8aca74315.zip |
Maven profiles for each technical stack
and remove sonar-channel helpers from sonar-testing-harness
Diffstat (limited to 'sonar-testing-harness/src/test/java/org')
-rw-r--r-- | sonar-testing-harness/src/test/java/org/sonar/test/TestUtilsTest.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sonar-testing-harness/src/test/java/org/sonar/test/TestUtilsTest.java b/sonar-testing-harness/src/test/java/org/sonar/test/TestUtilsTest.java index 54a0d903357..f06d434441c 100644 --- a/sonar-testing-harness/src/test/java/org/sonar/test/TestUtilsTest.java +++ b/sonar-testing-harness/src/test/java/org/sonar/test/TestUtilsTest.java @@ -24,6 +24,7 @@ import org.junit.Test; import java.io.File; import static org.fest.assertions.Assertions.assertThat; +import static org.fest.assertions.Fail.fail; import static org.sonar.test.TestUtils.getResource; public class TestUtilsTest { @@ -45,4 +46,47 @@ public class TestUtilsTest { File file = getResource("org/sonar/test/TestUtilsTest/unknown.txt"); assertThat(file).isNull(); } + + @Test + public void hasOnlyPrivateConstructors() { + assertThat(TestUtils.hasOnlyPrivateConstructors(TestUtils.class)).isTrue(); + assertThat(TestUtils.hasOnlyPrivateConstructors(OnlyPrivateConstructors.class)).isTrue(); + assertThat(TestUtils.hasOnlyPrivateConstructors(MixOfPublicAndPrivateConstructors.class)).isFalse(); + try { + TestUtils.hasOnlyPrivateConstructors(FailToInstantiate.class); + fail(); + } catch (IllegalStateException e) { + // ok + } + } + + public static class OnlyPrivateConstructors { + private OnlyPrivateConstructors() { + } + + private OnlyPrivateConstructors(int i) { + } + + public static void foo() { + + } + } + + public static class MixOfPublicAndPrivateConstructors { + private MixOfPublicAndPrivateConstructors() { + } + + public MixOfPublicAndPrivateConstructors(int i) { + } + + public static void foo() { + + } + } + + public static class FailToInstantiate { + private FailToInstantiate() { + throw new IllegalArgumentException(); + } + } } |