package to.etc.testutil;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * @author <a href="mailto:jal@etc.to">Frits Jalvingh</a>
 * Created on 15-04-22.
 */
final public class TestUtil {
	private TestUtil() {
	}

	public static void nonTestPrintln(String text) {
		if(!inTest())
			System.out.println(text);
	}

	static public boolean inTest() {
		return System.getProperty("surefire.real.class.path") != null || System.getProperty("surefire.test.class.path") != null;
	}

	static public String getGitBranch() {
		try {
			Process process = Runtime.getRuntime().exec("git rev-parse --abbrev-ref HEAD");
			process.waitFor();
			BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
			return reader.readLine();
		} catch(Exception x) {
			return null;
		}
	}

	static public void main(String[] args) {
		System.out.println("branch: " + getGitBranch());
	}

}

@@ -205,16 +205,54 @@
 tUtil %7B%0A
+%09private static boolean m_mavenTest;%0A%0A
 %09private
@@ -952,10 +952,299 @@
 ));%0A%09%7D%0A%0A
+%09public static synchronized boolean isMavenTest() %7B%0A%09%09Boolean mavenTest = m_mavenTest;%0A%09%09if(null == mavenTest) %7B%0A%09%09%09mavenTest = m_mavenTest = System.getProperty(%22surefire.real.class.path%22) != null%0A%09%09%09%09%7C%7C System.getProperty(%22surefire.test.class.path%22) != null;%0A%0A%09%09%7D%0A%09%09return mavenTest;%0A%09%7D%0A%0A
 %7D%0A

Add check whether test runs under maven