Shared JUnit 5 test helpers for 100xSystems Java curriculum.
Eliminates boilerplate duplication across lesson test files — the Java equivalent of @100xsystems/test-suite-typescript.
| Helper | Type | Description |
|---|---|---|
BaseTest |
Abstract class | Extend this in lesson tests. Provides assertions, helpers, temp dir utilities |
FileHelper |
Static utility | File existence checks, content reading, directory listing |
BuildHelper |
Static utility | Maven compile/test execution, command running |
Add the dependency to your lesson's pom.xml:
<dependencies>
<dependency>
<groupId>com.100xsystems</groupId>
<artifactId>test-suite-java</artifactId>
<version>0.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>Then in your lesson test file:
import com.systems.testhelper.BaseTest;
import org.junit.jupiter.api.Test;
class Lesson1Test extends BaseTest {
@Test
void hasPomXml() {
assertFileExists("pom.xml");
}
@Test
void hasMainClass() {
assertFileExists("src/main/java/com/claudecode/Main.java");
}
@Test
void buildSucceeds() {
expectBuildSucceeds();
}
@Test
void pomHasPicocli() {
assertFileContains("pom.xml", "picocli");
}
}assertFileExists(path)— file exists checkassertFileNotExists(path)— file does not existassertDirExists(path)— directory existsassertFileContains(path, substring)— content substring checkassertFileNotContains(path, substring)— content absence checkassertFileMatches(path, regex)— content regex matchassertFileHasContent(path)— non-empty file check
readFile(path)— read UTF-8 contentreadJsonString(path)— read and validate JSON
expectBuildSucceeds()— runmvn compileand assert successrunCommand(command)— run any shell commandrunMavenCompile()/runMavenTest()— Maven lifecycle commands
withTempDir(fn)— create, use, and clean up a temp directorywithTempFile(name, content, fn)— create, write, use, and clean up
# Set up GitHub token in ~/.m2/settings.xml
# Then:
mvn deployMIT