Skip to content

Commit

Permalink
feat: junit
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisTurco committed Nov 6, 2024
1 parent f27517a commit 125bf87
Show file tree
Hide file tree
Showing 15 changed files with 1,906 additions and 2,804 deletions.
39 changes: 20 additions & 19 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,46 @@ name: Java CI with Maven

on:
push:
branches: [ "master" ]
branches: [ "master" ] # Trigger the action on push to the master branch
pull_request:
branches: [ "master" ]
branches: [ "master" ] # Trigger the action on pull requests targeting the master branch

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-latest # Use the latest version of Ubuntu for the build environment

steps:
# Check out the code from the repository
- uses: actions/checkout@v4
# Step 1: Check out the code from the repository
- name: Check out code
uses: actions/checkout@v4

# Set up JDK 19
# Step 2: Set up JDK 19
- name: Set up JDK 19
uses: actions/setup-java@v4
with:
java-version: '19'
distribution: 'temurin'
cache: maven
distribution: 'temurin' # Use the Temurin distribution for OpenJDK
cache: maven # Cache Maven dependencies to speed up subsequent builds

# Clean and build with Maven
# Step 3: Clean and build with Maven
- name: Build with Maven
run: mvn -B clean package --file pom.xml
run: mvn -B clean package --file pom.xml # Build the project with Maven, suppress the interactive mode

# Run tests to ensure code quality
# Step 4: Run Tests
- name: Run Tests
run: mvn test --file pom.xml
run: mvn test --file pom.xml # Run the tests to ensure the code works as expected

# Upload the built JAR file as an artifact
# Step 5: Upload the built JAR file as an artifact
- name: Upload JAR Artifact
uses: actions/upload-artifact@v3
with:
name: backupmanager-jar
path: target/BackupManager-1.0-SNAPSHOT-jar-with-dependencies.jar
name: backupmanager-jar # Name of the artifact
path: target/BackupManager-1.0-SNAPSHOT-jar-with-dependencies.jar # Path to the JAR file

# Run static code analysis with SpotBugs (optional, requires SpotBugs plugin in POM)
# Step 6: Static Code Analysis with SpotBugs (optional)
- name: Static Code Analysis with SpotBugs
run: mvn com.github.spotbugs:spotbugs-maven-plugin:spotbugs
run: mvn com.github.spotbugs:spotbugs-maven-plugin:spotbugs # Run SpotBugs for static code analysis

# Update dependency graph to improve Dependabot alerts
# Step 7: Update dependency graph to improve Dependabot alerts
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 # Submit dependency graph for security monitoring
52 changes: 52 additions & 0 deletions nullnull
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
2024-11-06T22:02:09.732789100 [INFO] Test info message
2024-11-06T21:54:56.764714600 [INFO] Test info message
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:56)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:184)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:148)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
16 changes: 16 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@
<scope>test</scope>
</dependency>

<!-- JUnit 5 dependency -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>

<!-- Mockito dependency -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.0.0</version>
<scope>test</scope>
</dependency>

<!-- Dependency for flatlaf -->
<dependency>
<groupId>com.formdev</groupId>
Expand Down
Loading

0 comments on commit 125bf87

Please sign in to comment.