aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-testing-harness
diff options
context:
space:
mode:
authorJenkins CI <ci@sonarsource.com>2014-09-25 23:43:35 +0200
committerJenkins CI <ci@sonarsource.com>2014-09-25 23:43:35 +0200
commitb685462248789067942332c9bc584c21544756ff (patch)
tree777ae9e54e582066e48afc1fbbcd1256ab935520 /sonar-testing-harness
parent48d48e90931782cc1e94768a83ada71275476ceb (diff)
parentea1ac3789b9128e394284d82dfeaeab32dd441d8 (diff)
downloadsonarqube-b685462248789067942332c9bc584c21544756ff.tar.gz
sonarqube-b685462248789067942332c9bc584c21544756ff.zip
Automatic merge from branch-4.5
* origin/branch-4.5: SONAR-4898 add missing tests SONAR-4898 add missing tests Use correct temp dir for Ruby on Rails app Fail server startup if can not connect to DB
Diffstat (limited to 'sonar-testing-harness')
-rw-r--r--sonar-testing-harness/src/main/java/org/sonar/test/TestUtils.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/TestUtils.java b/sonar-testing-harness/src/main/java/org/sonar/test/TestUtils.java
index e537466d262..0a5d8fcaef0 100644
--- a/sonar-testing-harness/src/main/java/org/sonar/test/TestUtils.java
+++ b/sonar-testing-harness/src/main/java/org/sonar/test/TestUtils.java
@@ -23,8 +23,13 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
import java.net.URL;
+import static org.fest.assertions.Assertions.assertThat;
+import static org.fest.assertions.Fail.fail;
+
/**
* Utilities for unit tests
*
@@ -67,4 +72,15 @@ public final class TestUtils {
resourcePath += path;
return getResource(resourcePath);
}
+
+ public static void assertPrivateConstructor(Class clazz) {
+ try {
+ Constructor constructor = clazz.getDeclaredConstructor();
+ assertThat(Modifier.isPrivate(constructor.getModifiers())).isTrue();
+ constructor.setAccessible(true);
+ constructor.newInstance();
+ } catch (Exception e) {
+ fail("Fail to instantiate " + clazz, e);
+ }
+ }
}