Skip to content

Commit

Permalink
Add test from unnamed module
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebemish committed Apr 11, 2024
1 parent 3651db5 commit 4a1704c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
13 changes: 13 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,20 @@ tasks.named('compileTestJava', JavaCompile) {
options.fork = true
}

sourceSets {
module
}

dependencies {
testImplementation sourceSets.module.output
}

tasks.named('test', Test) {
testClassesDirs += files(
sourceSets.test.output,
sourceSets.module.output
)

def newClasspath = objects.fileCollection()
newClasspath.from(configurations.testRuntimeClasspath)
newClasspath.from(sourceSets.test.output)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package dev.lukebemish.emojiidentifiers.test.module;

public class InModule {
}
3 changes: 3 additions & 0 deletions src/module/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module dev.lukebemish.emojiidentifiers.test.module {
opens dev.lukebemish.emojiidentifiers.test.module;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package dev.lukebemish.emojiidentifiers.test.🧩;

import dev.lukebemish.emojiidentifiers.test.module.InModule;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class TestPackageWithEmoji {
@Test
void testPackageWithEmoji() {

assertEquals("dev.lukebemish.emojiidentifiers.test.module", InModule.class.getModule().getName());
}
}

0 comments on commit 4a1704c

Please sign in to comment.