Skip to content

Commit

Permalink
Fix tests to work with Java 9
Browse files Browse the repository at this point in the history
- JUnitConsoleLoggingIntegrationTest and TestNGConsoleLoggingIntegrationTest: The stacktrace now includes internal Java 9 Reflection API:
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(java.base@9-ea/NativeConstructorAccessorImpl.java:62)
        at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(java.base@9-ea/DelegatingConstructorAccessorImpl.java:45)

- Javadoc-Tests:
   There is no toolsJar for Java 9 - tests work without that.

+review REVIEW-6057
  • Loading branch information
wolfs committed Jun 14, 2016
1 parent 909722b commit 1aa0def
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 25 deletions.
41 changes: 26 additions & 15 deletions gradle/java9.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,17 @@ task java9IntegTest(type: Test) {
"IvyPublishHttpIntegTest",
"IvyHttpPublishIntegrationTest",


/* java.lang.RuntimeException: Annotation Processor Classpath is contaminated by Gradle ClassLoader
at com.test.SimpleAnnotationProcessor.process(SimpleAnnotationProcessor.java:22)
for tests involving Annotatinon Processor
for tests involving Annotation Processor
*/
"InProcessGroovyCompilerIntegrationTest",
"InProcessJavaCompilerIntegrationTest",
/*
"executesTestsInCorrectEnvironment"
gradle-worker.jar is part of the Classpath for the test.
*/
"JUnitIntegrationTest",

/*
java.lang.reflect.InaccessibleObjectException: Cannot make a non-public member of class java.lang.reflect.AccessibleObject accessible
Expand All @@ -151,25 +156,31 @@ task java9IntegTest(type: Test) {
*/
"InvokeDynamicGroovyCompilerSpec",

"InProcessJavaCompilerIntegrationTest",
"DaemonJavaCompilerIntegrationTest",
"EclipseClasspathIntegrationTest",
"EclipseIntegrationTest",
"IdeaJavaLanguageSettingsIntegrationTest",

// Various problems, eg scala compile
"UserGuideSamplesIntegrationTest",

// ??
/*
"compile only dependencies are not included in distribution":
error: error reading ...1.0/compile-1.0.jar; zip END header not found
*/
"ApplicationPluginIntegrationTest",
/*
"resolved classpath does not include transitive compile-scoped maven dependencies of local components"
"resolved classpath includes transitive api-scoped dependencies of maven library dependency"
error: zip END header not found
*/
"JavaLanguageExternalDependencyResolutionIntegrationTest",

/*
Changes in Javadoc generation
*/
"SamplesJavaMultiProjectIntegrationTest",
"JavaCompileIntegrationTest",

/*
* "dashboard includes JaCoCo reports" fails since Jacoco fails
*/
"BuildDashboardPluginIntegrationTest",
"JavaLanguageExternalDependencyResolutionIntegrationTest",
"JavadocIntegrationTest",
"JUnitConsoleLoggingIntegrationTest",
"JUnitIntegrationTest",
"TestNGConsoleLoggingIntegrationTest",

"JacocoPluginIntegrationTest",
"EnvJsPluginIntegrationTest",
"GradleRunnerSamplesEndUserIntegrationTest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ sourceSets {
}

dependencies {
tagletCompile files(Jvm.current().toolsJar)
if (Jvm.current().toolsJar) {
tagletCompile files(Jvm.current().toolsJar)
}
}

javadoc {
Expand All @@ -18,4 +20,4 @@ javadoc {
taglets 'LocaleAwareTaglet'
tagletPath sourceSets.taglet.output.classesDir
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ sourceSets {
}

dependencies {
tagletCompile files(Jvm.current().toolsJar)
if (Jvm.current().toolsJar) {
tagletCompile files(Jvm.current().toolsJar)
}
}

javadoc {
Expand All @@ -20,4 +22,4 @@ javadoc {
taglets 'CustomTaglet'
tagletPath sourceSets.taglet.output.classesDir
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ org.gradle.JUnit4Test > badTest FAILED
then:
outputContains("""
badTest FAILED
java.lang.RuntimeException: bad
at org.gradle.JUnit4Test.beBad(JUnit4Test.groovy:44)
at org.gradle.JUnit4Test.badTest(JUnit4Test.groovy:28)
""")
java.lang.RuntimeException: bad""")
outputContains("""
at org.gradle.JUnit4Test.beBad(JUnit4Test.groovy:44)
at org.gradle.JUnit4Test.badTest(JUnit4Test.groovy:28)""")

outputContains("ignoredTest SKIPPED")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.gradle.testing.testng

import org.gradle.integtests.fixtures.AbstractIntegrationSpec

// can make assumptions about order in which test methods of TestNGTest get executed
// because the methods are chained with 'methodDependsOn'
class TestNGConsoleLoggingIntegrationTest extends AbstractIntegrationSpec {
Expand Down Expand Up @@ -102,7 +101,9 @@ Gradle test > org.gradle.TestNGTest.badTest FAILED
then:
outputContains("""
Gradle test > org.gradle.TestNGTest.badTest FAILED
java.lang.RuntimeException: bad
java.lang.RuntimeException: bad""")

outputContains("""
at org.gradle.TestNGTest.beBad(TestNGTest.groovy:25)
at org.gradle.TestNGTest.badTest(TestNGTest.groovy:12)
Expand Down

0 comments on commit 1aa0def

Please sign in to comment.