/**
 * The MIT License
 * Copyright (c) 2014 Benoit Lacelle
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package blasd.apex.core.agent;

import java.lang.instrument.Instrumentation;
import java.util.logging.Logger;

import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;

import com.google.common.base.Optional;

public class TestInstrumentAgent {
	protected static final Logger LOGGER = Logger.getLogger(TestInstrumentAgent.class.getName());

	// https://stackoverflow.com/questions/2591083/getting-java-version-at-runtime
	public static final boolean IS_JDK_9;

	static {
		System.out.println(Runtime.class.getPackage().getImplementationVersion());
		System.out.println(Runtime.class.getPackage().getSpecificationVersion());
		System.out.println(System.getProperty("java.specification.version"));
		System.out.println(System.getProperty("java.version"));
		IS_JDK_9 = Runtime.class.getPackage().getSpecificationVersion().contains("1.9.");
	}

	@Test
	public void test_ctor() {
		Assert.assertNotNull(new InstrumentationAgent());
	}

	@Test
	public void testGetInstrument() {
		Assume.assumeTrue("TODO JDK9", TestInstrumentAgent.IS_JDK_9);

		Optional<Instrumentation> instrument = InstrumentationAgent.getInstrumentation();

		Assert.assertTrue(instrument.isPresent());
	}
}

@@ -1625,370 +1625,78 @@
 %7B%0A%09%09
-System.out.println(Runtime.class.getPackage().getImplementationVersion());%0A%09%09System.out.println(Runtime.class.getPackage().getSpecificationVersion());%0A%09%09System.out.println(System.getProperty(%22java.specification.version%22));%0A%09%09System.out.println(System.getProperty(%22java.version%22));%0A%09%09IS_JDK_9 = Runtime.class.getPackage().getSpecificationVersion().contains(%221.9.%22
+IS_JDK_9 = %229%22.equals(System.getProperty(%22java.specification.version%22)
 );%0A%09

Fix jdk9 detection