:samples-dir: /mnt/tcagent1/work/ff6c2020506a5c2d/promote-projects/gradle/build/git-checkout/subprojects/docs/build/working/samples/install/java-components-with-jUnit4-tests
:gradle-version: 6.3-rc-4

= Testing with JUnit4 Sample

[.download]
- link:zips/sample_java_components_with_junit4_tests-groovy-dsl.zip[icon:download[] Groovy DSL]
- link:zips/sample_java_components_with_junit4_tests-kotlin-dsl.zip[icon:download[] Kotlin DSL]

NOTE: You can open this sample inside an IDE using the https://www.jetbrains.com/help/idea/gradle.html#gradle_import_project_start[IntelliJ native importer] or https://projects.eclipse.org/projects/tools.buildship[Eclipse Buildship].

This sample shows how to test Java projects with link:https://junit.org/junit4/[JUnit4] in Gradle.

For applications:

====
include::sample[dir="groovy",files="application/build.gradle[]"]
include::sample[dir="kotlin",files="application/build.gradle.kts[]"]
====

For libraries:

====
include::sample[dir="groovy",files="list/build.gradle[]"]
include::sample[dir="kotlin",files="list/build.gradle.kts[]"]
====

Running the tests:

[listing.terminal.sample-command]
----
$ ./gradlew test

BUILD SUCCESSFUL
5 actionable tasks: 5 executed
----

For more information, see link:{userManualPath}/java_testing.html[Testing in Java project chapter].

You can also generate this project locally using link:{userManualPath}/build_init_plugin.html#sec:java_application[`gradle init`].
