Skip to content

Commit

Permalink
Create resource & temp dir extensions (#348 / #491)
Browse files Browse the repository at this point in the history
Introduces a general mechanism to inject resources into tests. These
resources are either newly created for each test or shared across
several tests - depending on which annotation was used.

This change also introduces a specific resource that uses this
mechanism, namely the temporary directory extension.

Closes: #348
Relates to: #141
PR: #491
  • Loading branch information
jbduncan committed Nov 14, 2022
1 parent 8b284b8 commit 7f56ffe
Show file tree
Hide file tree
Showing 32 changed files with 4,209 additions and 361 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -38,3 +38,6 @@ hs_err_pid*

# MacOS
.DS_Store

# asdf-vm
.tool-versions
11 changes: 11 additions & 0 deletions build.gradle.kts
Expand Up @@ -12,6 +12,7 @@ plugins {
id("org.shipkit.shipkit-github-release") version "1.1.15"
id("com.github.ben-manes.versions") version "0.42.0"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("org.gradlex.extra-java-module-info") version "1.0"
}

plugins.withType<JavaPlugin>().configureEach {
Expand Down Expand Up @@ -191,6 +192,15 @@ nexusPublishing {
}
}

extraJavaModuleInfo {
failOnMissingModuleInfo.set(false)
automaticModule("com.google.guava:failureaccess", "com.google.guava.failureaccess")
automaticModule("com.google.guava:listenablefuture", "com.google.guava.listenablefuture")
automaticModule("com.google.code.findbugs:jsr305", "com.google.code.findbugs.jsr305")
automaticModule("com.google.j2objc:j2objc-annotations", "com.google.j2objc.annotations")
automaticModule("com.google.jimfs:jimfs", "com.google.jimfs")
}

tasks {

sourceSets {
Expand Down Expand Up @@ -288,6 +298,7 @@ tasks {
val demoTests by registering(JvmTestSuite::class) {
dependencies {
implementation(project)
implementation("com.google.jimfs:jimfs:1.2")
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
implementation("org.assertj:assertj-core:3.22.0")
}
Expand Down
6 changes: 5 additions & 1 deletion docs/docs-nav.yml
Expand Up @@ -26,14 +26,18 @@
url: /docs/report-entries/
- title: "Range Sources"
url: /docs/range-sources/
- title: "Resources"
url: /docs/resources/
- title: "Retrying Failing Tests"
url: /docs/retrying-test/
- title: "Standard Input and Output"
url: /docs/standard-input-output/
- title: "Measuring time with a Stopwatch"
url: /docs/stopwatch/
- title: "Temporary Files and Directories (removed in 1.0)"
- title: "Temporary Directories"
url: /docs/temp-directory/
- title: "Temporary Files and Directories (removed in 1.0)"
url: /docs/temp-directory-removed/
- title: "Vintage @Test"
url: /docs/vintage-test/

0 comments on commit 7f56ffe

Please sign in to comment.