Skip to content

Commit

Permalink
test: add JUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
wtnabe committed Jan 31, 2024
1 parent 0c6853a commit 9c60b0e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
push:
branches:
- main
- pull-req/**
- release/**
- hotfix/**
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- run: ./gradlew build
16 changes: 16 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ jar {
}
}

repositories {
mavenCentral()
}

test {
reports.html.required = false
dependsOn cleanTest
testLogging.showStandardStreams = true
}

dependencies {
// https://mvnrepository.com/artifact/junit/junit
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

tasks.withType(JavaCompile) { // gradle's default is not utf-8
options.encoding = 'UTF-8'
}
9 changes: 9 additions & 0 deletions src/test/java/HelloTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;

public class HelloTest {
@Test
public void TestHelloMain () {
assertNotNull(new Hello());
}
}

0 comments on commit 9c60b0e

Please sign in to comment.