Skip to content

Commit

Permalink
adjust tests to new layout
Browse files Browse the repository at this point in the history
  • Loading branch information
robstoll committed Dec 27, 2024
1 parent 8b385b7 commit dddd9c5
Show file tree
Hide file tree
Showing 223 changed files with 2,567 additions and 2,138 deletions.
203 changes: 111 additions & 92 deletions .github/workflows/quality-assurance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,105 +3,124 @@ name: Quality Assurance
on: [ push, pull_request ]

jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
test:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Generate matrix
id: set-matrix
run: node .github/workflows/matrix.js

build-and-test:
needs: generate-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.java_distribution }}
java-version: ${{ matrix.java_version }}

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build using JDK ${{ matrix.java_version }}
run: ./gradlew build

- name: Upload build code coverage
uses: codecov/[email protected]
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ matrix.os == 'windows-latest' && 'current_windows' || 'current' }}
env_vars: JAVA_VERSION

- name: Composite build atrium-samples-test
run: ./gradlew build
working-directory: misc/tools/atrium-samples-test

dexer:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Cache Android jar
id: android-cache
uses: actions/cache@v4
with:
path: android-jar-cache
key: ${{ runner.os }}-android-version-26

- name: Download Android SDK's android.jar (or use cached file)
if: steps.android-cache.outputs.cache-hit != 'true'
run: |
mkdir android-jar-cache
cd android-jar-cache
curl -o android.jar -L "https://github.com/Sable/android-platforms/blob/master/android-26/android.jar?raw=true"
echo "cdc1846376a14b0370cc63454a129606b4a52cc50ada75ef0d4cf956b1ad2daa android.jar" > android.sha256
if ! sha256sum -c android.sha256; then
echo >&2 "wrong sha256 for android.jar, expected:"
cat >&2 android.sha256
echo >&2 "actual:"
sha256sum android.jar
exit 1;
fi
- name: Check Atrium's -jvm.jar can be dexed
run: ATRIUM_ANDROID_JAR="$PWD/android-jar-cache/android.jar" ./gradlew checkDexer

forwardCompatibility:
env:
JAVA_VERSION: 17
KOTLIN_VERSION: ${{ matrix.kotlin_version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kotlin_version: [ '1.5', '1.6', '1.7', '1.8', '1.9', '2.0' ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
distribution: sapmachine
java-version: 11

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build using Kotlin ${{ matrix.kotlin_version }}
run: ./gradlew build
- name: Build using JDK
run: ./gradlew :atrium-api-infix:jvmTest
#
# generate-matrix:
# runs-on: ubuntu-latest
# outputs:
# matrix: ${{ steps.set-matrix.outputs.matrix }}
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# fetch-depth: 1
#
# - name: Generate matrix
# id: set-matrix
# run: node .github/workflows/matrix.js
#
# build-and-test:
# name: b&t ${{ matrix.name }}
# needs: generate-matrix
# runs-on: ${{ matrix.os }}
# strategy:
# matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Set up JDK ${{ matrix.java_version }}
# uses: actions/setup-java@v4
# with:
# distribution: ${{ matrix.java_distribution }}
# java-version: ${{ matrix.java_version }}
#
# - name: Setup Gradle
# uses: gradle/actions/setup-gradle@v4
#
# - name: Build using JDK ${{ matrix.java_version }}
# run: ./gradlew build
#
# - name: Upload build code coverage
# uses: codecov/[email protected]
# if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# flags: ${{ matrix.os == 'windows-latest' && 'current_windows' || 'current' }}
# env_vars: JAVA_VERSION
#
# - name: Composite build atrium-samples-test
# run: ./gradlew build
# working-directory: misc/tools/atrium-samples-test
#
# dexer:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# fetch-depth: 1
#
# - name: Cache Android jar
# id: android-cache
# uses: actions/cache@v4
# with:
# path: android-jar-cache
# key: ${{ runner.os }}-android-version-26
#
# - name: Download Android SDK's android.jar (or use cached file)
# if: steps.android-cache.outputs.cache-hit != 'true'
# run: |
# mkdir android-jar-cache
# cd android-jar-cache
# curl -o android.jar -L "https://github.com/Sable/android-platforms/blob/master/android-26/android.jar?raw=true"
# echo "cdc1846376a14b0370cc63454a129606b4a52cc50ada75ef0d4cf956b1ad2daa android.jar" > android.sha256
# if ! sha256sum -c android.sha256; then
# echo >&2 "wrong sha256 for android.jar, expected:"
# cat >&2 android.sha256
# echo >&2 "actual:"
# sha256sum android.jar
# exit 1;
# fi
#
# - name: Check Atrium's -jvm.jar can be dexed
# run: ATRIUM_ANDROID_JAR="$PWD/android-jar-cache/android.jar" ./gradlew checkDexer
#
# forwardCompatibility:
# env:
# JAVA_VERSION: 17
# KOTLIN_VERSION: ${{ matrix.kotlin_version }}
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# kotlin_version: [ '1.5', '1.6', '1.7', '1.8', '1.9', '2.0' ]
# steps:
# - uses: actions/checkout@v4
# - name: Set up JDK 17
# uses: actions/setup-java@v4
# with:
# distribution: 'adopt'
# java-version: 17
#
# - name: Setup Gradle
# uses: gradle/actions/setup-gradle@v4
#
# - name: Build using Kotlin ${{ matrix.kotlin_version }}
# run: ./gradlew build
126 changes: 63 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,15 @@ I expected subject : () -> kotlin.Nothing (readme.examples.ToThrowExample
🚩️ ▶ thrown exception when called : java.lang.IllegalArgumentException
🚫️ to be an instance of type : IllegalStateException (java.lang.IllegalStateException)
ℹ️ Properties of the unexpected IllegalArgumentException
» message : "name is empty"
» stacktrace :
• readme.examples.ToThrowExamples$ex-toThrow1$1.invoke(ToThrowExamples.kt:18)
• readme.examples.ToThrowExamples$ex-toThrow1$1.invoke(ToThrowExamples.kt:16)
• readme.examples.ToThrowExamples.ex-toThrow1(ToThrowExamples.kt:47)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
• java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
• java.base/java.lang.reflect.Method.invoke(Method.java:566)
» message : "name is empty"
» stacktrace :
• readme.examples.ToThrowExamples$ex-toThrow1$1.invoke(ToThrowExamples.kt:18)
• readme.examples.ToThrowExamples$ex-toThrow1$1.invoke(ToThrowExamples.kt:16)
• readme.examples.ToThrowExamples.ex-toThrow1(ToThrowExamples.kt:47)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
• java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
• java.base/java.lang.reflect.Method.invoke(Method.java:566)
```
</ex-toThrow1>

Expand Down Expand Up @@ -435,19 +435,19 @@ expect {
I expected subject : () -> kotlin.Nothing (readme.examples.ToThrowExamples$ex-notToThrow$1 <1234789>)
🚩️ ▶ invoke() : ❗❗ threw java.lang.IllegalArgumentException
ℹ️ Properties of the unexpected IllegalArgumentException
» message : "name is empty"
» stacktrace :
• readme.examples.ToThrowExamples$ex-notToThrow$1.invoke(ToThrowExamples.kt:42)
• readme.examples.ToThrowExamples$ex-notToThrow$1.invoke(ToThrowExamples.kt:40)
• readme.examples.ToThrowExamples.ex-notToThrow(ToThrowExamples.kt:43)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
• java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
• java.base/java.lang.reflect.Method.invoke(Method.java:566)
» cause : java.lang.RuntimeException
» message : "a cause"
» stacktrace :
• readme.examples.ToThrowExamples$ex-notToThrow$1.invoke(ToThrowExamples.kt:42)
» message : "name is empty"
» stacktrace :
• readme.examples.ToThrowExamples$ex-notToThrow$1.invoke(ToThrowExamples.kt:42)
• readme.examples.ToThrowExamples$ex-notToThrow$1.invoke(ToThrowExamples.kt:40)
• readme.examples.ToThrowExamples.ex-notToThrow(ToThrowExamples.kt:43)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
• java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
• java.base/java.lang.reflect.Method.invoke(Method.java:566)
» cause : java.lang.RuntimeException
» message : "a cause"
» stacktrace :
• readme.examples.ToThrowExamples$ex-notToThrow$1.invoke(ToThrowExamples.kt:42)
```
</ex-notToThrow>

Expand Down Expand Up @@ -1763,23 +1763,23 @@ expect(-10).notToBeNegative()
I expected subject : -10
🚩️ not to be : negative
ℹ️ Properties of the unexpected AssertionError
» message : """
Expecting actual:
-10
to be greater than or equal to:
0
"""
» stacktrace :
• readme.examples.ThirdPartyExamples$ex-third-party-2$notToBeNegative$1.invoke(ThirdPartyExamples.kt:39)
• readme.examples.ThirdPartyExamples$ex-third-party-2$notToBeNegative$1.invoke(ThirdPartyExamples.kt:37)
• readme.examples.ThirdPartyExamples.ex_third_party_2$notToBeNegative(ThirdPartyExamples.kt:37)
• readme.examples.ThirdPartyExamples.ex-third-party-2(ThirdPartyExamples.kt:49)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
• java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
• java.base/java.lang.reflect.Method.invoke(Method.java:566)
» message : """
Expecting actual:
-10
to be greater than or equal to:
0
"""
» stacktrace :
• readme.examples.ThirdPartyExamples$ex-third-party-2$notToBeNegative$1.invoke(ThirdPartyExamples.kt:39)
• readme.examples.ThirdPartyExamples$ex-third-party-2$notToBeNegative$1.invoke(ThirdPartyExamples.kt:37)
• readme.examples.ThirdPartyExamples.ex_third_party_2$notToBeNegative(ThirdPartyExamples.kt:37)
• readme.examples.ThirdPartyExamples.ex-third-party-2(ThirdPartyExamples.kt:49)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
• java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
• java.base/java.lang.reflect.Method.invoke(Method.java:566)
```
</ex-third-party-2>

Expand Down Expand Up @@ -2113,19 +2113,19 @@ I expected subject : () -> kotlin.Nothing (readme.examples.MostExamples$e
• value : "no no no"
» but no match was found
ℹ️ Properties of the unexpected IllegalArgumentException
» message : "no no no..."
» stacktrace :
• readme.examples.MostExamples$ex-add-info-3$1.invoke(MostExamples.kt:117)
• readme.examples.MostExamples$ex-add-info-3$1.invoke(MostExamples.kt:113)
• readme.examples.MostExamples.ex-add-info-3(MostExamples.kt:148)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
• java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
• java.base/java.lang.reflect.Method.invoke(Method.java:566)
» cause : java.lang.UnsupportedOperationException
» message : "not supported"
» stacktrace :
• readme.examples.MostExamples$ex-add-info-3$1.invoke(MostExamples.kt:115)
» message : "no no no..."
» stacktrace :
• readme.examples.MostExamples$ex-add-info-3$1.invoke(MostExamples.kt:117)
• readme.examples.MostExamples$ex-add-info-3$1.invoke(MostExamples.kt:113)
• readme.examples.MostExamples.ex-add-info-3(MostExamples.kt:148)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
• java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
• java.base/java.lang.reflect.Method.invoke(Method.java:566)
» cause : java.lang.UnsupportedOperationException
» message : "not supported"
» stacktrace :
• readme.examples.MostExamples$ex-add-info-3$1.invoke(MostExamples.kt:115)
```
</ex-add-info-3>

Expand Down Expand Up @@ -2311,17 +2311,17 @@ expect(MyDomainModel(alpha1 = 1204)).toComplyValidation()
I expected subject : MyDomainModel(alpha1=1204) (readme.examples.ThirdPartyExamples.MyDomainModel <1234789>)
🚩️ to comply : validation
ℹ️ Properties of the unexpected IllegalStateException
» message : "threshold value for alpha1 exceeded, expected <= 1000, was 1204"
» stacktrace :
• readme.examples.ThirdPartyExamples.validateMaxThreshold(ThirdPartyExamples.kt:76)
• readme.examples.ThirdPartyExamples$ex-third-party-10$toComplyValidation$1.invoke(ThirdPartyExamples.kt:84)
• readme.examples.ThirdPartyExamples$ex-third-party-10$toComplyValidation$1.invoke(ThirdPartyExamples.kt:82)
• readme.examples.ThirdPartyExamples.ex_third_party_10$toComplyValidation(ThirdPartyExamples.kt:82)
• readme.examples.ThirdPartyExamples.ex-third-party-10(ThirdPartyExamples.kt:88)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
• java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
• java.base/java.lang.reflect.Method.invoke(Method.java:566)
» message : "threshold value for alpha1 exceeded, expected <= 1000, was 1204"
» stacktrace :
• readme.examples.ThirdPartyExamples.validateMaxThreshold(ThirdPartyExamples.kt:76)
• readme.examples.ThirdPartyExamples$ex-third-party-10$toComplyValidation$1.invoke(ThirdPartyExamples.kt:84)
• readme.examples.ThirdPartyExamples$ex-third-party-10$toComplyValidation$1.invoke(ThirdPartyExamples.kt:82)
• readme.examples.ThirdPartyExamples.ex_third_party_10$toComplyValidation(ThirdPartyExamples.kt:82)
• readme.examples.ThirdPartyExamples.ex-third-party-10(ThirdPartyExamples.kt:88)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
• java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
• java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
• java.base/java.lang.reflect.Method.invoke(Method.java:566)
```
</ex-third-party-10>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import ch.tutteli.atrium.logic.utils.toVarArg
import ch.tutteli.kbox.glue
import kotlin.jvm.JvmName

//TODO 2.0.0 switch to disjoint search, no idea why I used non-disjoint back then
/**
* Finishes the specification of the sophisticated `to contain` expectation where the [expected] object shall be searched,
* using a non-disjoint search.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ fun <E, T : IterableLike> EntryPointStep<E, T, InOrderOnlyGroupedWithinSearchBeh
firstGroup: Group<E>,
secondGroup: Group<E>,
vararg otherExpectedGroups: Group<E>,
//TODO 2.0.0 consider to introduce an own Option class as showOnlyFailingIfMoreExpectedElementsThan is a bit misleading in the context of groups
//i.e. OnlyReportingOptions
report: InOrderOnlyReportingOptions.() -> Unit = {},
reportInGroup: InAnyOrderOnlyReportingOptions.() -> Unit = {}
): Expect<T> = _logicAppend {
Expand Down
Loading

0 comments on commit dddd9c5

Please sign in to comment.