Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 36 additions & 4 deletions .github/workflows/maven-pr-builder.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Java PR Builder
name: Kotlin PR Tests

on:
pull_request_target:
Expand All @@ -9,10 +9,42 @@ permissions:
contents: read

jobs:
build-and-analyze:
test:
name: Run Tests
runs-on: ubuntu-22.04
steps:

- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'

- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

# Some tests need screen access
- name: Install xvfb
run: sudo apt-get install -y xvfb

- name: Build and Test
run: xvfb-run ./mvnw clean verify

name: Build on JDK 21
sonar-analysis:
name: SonarQube Analysis
runs-on: ubuntu-22.04
needs: test
steps:

- name: Checkout Code
Expand All @@ -33,7 +65,7 @@ jobs:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
${{ runner.os }}-maven-

# Cache Sonar packages which are used to run analysis and collect metrics
- name: Cache SonarCloud packages
Expand Down
35 changes: 0 additions & 35 deletions .github/workflows/presubmit.yml

This file was deleted.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<sonar.projectKey>iluwatar_java-design-patterns</sonar.projectKey>
<sonar.moduleKey>${project.artifactId}</sonar.moduleKey>
<sonar.projectName>Java Design Patterns</sonar.projectName>
<kotlin.version>2.2.0</kotlin.version>
<kotlin.version>2.2.21</kotlin.version>
</properties>
<modules>

Expand Down
2 changes: 1 addition & 1 deletion visitor/src/test/java/com/iluwatar/visitor/AppTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ import org.junit.jupiter.api.Test
internal class AppTest {
@Test
fun shouldExecuteWithoutException() {
assertDoesNotThrow { App.main(emptyArray()) }
assertDoesNotThrow { main() }
}
}
3 changes: 1 addition & 2 deletions visitor/src/test/java/com/iluwatar/visitor/CommanderTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@
package com.iluwatar.visitor

import org.mockito.Mockito
import org.mockito.ArgumentMatchers.eq

/** CommanderTest */
internal class CommanderTest : UnitTest<Commander>({ children -> Commander(*children) }) {
override fun verifyVisit(unit: Commander, mockedVisitor: UnitVisitor) {
Mockito.verify(mockedVisitor).visit(eq(unit))
Mockito.verify(mockedVisitor).visit(unit)
}
}
3 changes: 1 addition & 2 deletions visitor/src/test/java/com/iluwatar/visitor/SergeantTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@
package com.iluwatar.visitor

import org.mockito.Mockito
import org.mockito.ArgumentMatchers.eq

/** SergeantTest */
internal class SergeantTest : UnitTest<Sergeant>({ children -> Sergeant(*children) }) {
override fun verifyVisit(unit: Sergeant, mockedVisitor: UnitVisitor) {
Mockito.verify(mockedVisitor).visit(eq(unit))
Mockito.verify(mockedVisitor).visit(unit)
}
}
3 changes: 1 addition & 2 deletions visitor/src/test/java/com/iluwatar/visitor/SoldierTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@
package com.iluwatar.visitor

import org.mockito.Mockito
import org.mockito.ArgumentMatchers.eq

/** SoldierTest */
internal class SoldierTest : UnitTest<Soldier>({ children -> Soldier(*children) }) {
override fun verifyVisit(unit: Soldier, mockedVisitor: UnitVisitor) {
Mockito.verify(mockedVisitor).visit(eq(unit))
Mockito.verify(mockedVisitor).visit(unit)
}
}
Loading