aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.core.test/src/org/jacoco/core/test/validation/Source.java
diff options
context:
space:
mode:
authorMarc R. Hoffmann <hoffmann@mountainminds.com>2016-05-23 08:59:18 +0200
committerEvgeny Mandrikov <mandrikov@gmail.com>2016-05-23 08:59:18 +0200
commitea548107069803cd37a5410b9bf4c81936e8fcce (patch)
tree120a71b4750eb0310dfeada520f24d454c125df3 /org.jacoco.core.test/src/org/jacoco/core/test/validation/Source.java
parentccbf42b97bf126372ca76431881314e1eb57554e (diff)
downloadjacoco-ea548107069803cd37a5410b9bf4c81936e8fcce.tar.gz
GitHub #300: Allow standard Maven build with any JDK.
Test cases which require source level > 1.5 get separate source folders. These source folders are only considered if the corresponding "bytecode.version" property is specified for integration tests. The standard JaCoCo build targets Java 1.5 and will not execute any of these tests (regardless of the JDK version used for building).
Diffstat (limited to 'org.jacoco.core.test/src/org/jacoco/core/test/validation/Source.java')
-rw-r--r--org.jacoco.core.test/src/org/jacoco/core/test/validation/Source.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/org.jacoco.core.test/src/org/jacoco/core/test/validation/Source.java b/org.jacoco.core.test/src/org/jacoco/core/test/validation/Source.java
index 49c92977..da918a0e 100644
--- a/org.jacoco.core.test/src/org/jacoco/core/test/validation/Source.java
+++ b/org.jacoco.core.test/src/org/jacoco/core/test/validation/Source.java
@@ -12,6 +12,7 @@
package org.jacoco.core.test.validation;
import java.io.BufferedReader;
+import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
@@ -31,16 +32,18 @@ import java.util.regex.Pattern;
public class Source {
/**
- * Reads the source for the given type from the <code>./src/</code> folder
- * relative to the working directory.
+ * Reads the source for the given type from the given source folder relative
+ * to the working directory.
*
+ * @param srcFolder
+ * source folder
* @param type
* type to load the source file for
- * @throws IOException
- * @throws
*/
- public static Source getSourceFor(final Class<?> type) throws IOException {
- String file = "src/" + type.getName().replace('.', '/') + ".java";
+ public static Source getSourceFor(final String srcFolder,
+ final Class<?> type) throws IOException {
+ File folder = new File(srcFolder);
+ File file = new File(folder, type.getName().replace('.', '/') + ".java");
return new Source(new FileReader(file));
}