diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..a217b34
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,7 @@
+version: 2
+updates:
+- package-ecosystem: maven
+ directory: "/"
+ schedule:
+ interval: daily
+ open-pull-requests-limit: 10
diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml
index f2bca12..b1ba557 100644
--- a/.github/workflows/default.yml
+++ b/.github/workflows/default.yml
@@ -15,8 +15,10 @@ jobs:
matrix:
jdk: ['11.0.5']
steps:
+
- name: Checkout code
uses: actions/checkout@v1
+
- name: Cache .m2
uses: actions/cache@v1
with:
@@ -24,14 +26,18 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven
+
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.jdk }}
+
- name: Prepare Maven Wrapper
run: chmod +x ./mvnw
+
- name: Build with Maven
run: ./mvnw clean verify -U -B -T4
+
- name: Upolad coverage information
uses: codecov/codecov-action@v1
with:
diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml
index 20d0e09..7da8d23 100644
--- a/.github/workflows/master.yml
+++ b/.github/workflows/master.yml
@@ -12,13 +12,13 @@ jobs:
- name: Checkout code
uses: actions/checkout@v1
-# - name: Cache .m2
-# uses: actions/cache@v1
-# with:
-# path: ~/.m2/repository
-# key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-# restore-keys: |
-# ${{ runner.os }}-maven
+ - name: Cache .m2
+ uses: actions/cache@v1
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven
# Get GPG private key into GPG
- name: Import GPG Owner Trust
@@ -42,7 +42,7 @@ jobs:
run: ./mvnw clean verify -U -B -T4
- name: Deploy a new version to central
- run: ./mvnw clean deploy -B -DskipTests -DskipExamples -Prelease -Dgpg.keyname=${{secrets.GPG_KEYNAME}} -Dgpg.passphrase=${{secrets.GPG_PASSPHRASE}}
+ run: ./mvnw clean deploy -B -DskipTests -DskipExamples -Prelease -Dgpg.keyname="${{secrets.GPG_KEYNAME}}" -Dgpg.passphrase="${{secrets.GPG_PASSPHRASE}}"
env:
OSS_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
OSS_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
diff --git a/examples/basic/jgiven-reports/io.holunda.testing.examples.basic.ApprovalProcessTest.json b/examples/basic/jgiven-reports/io.holunda.testing.examples.basic.ApprovalProcessTest.json
index 4819bdd..9a89c68 100644
--- a/examples/basic/jgiven-reports/io.holunda.testing.examples.basic.ApprovalProcessTest.json
+++ b/examples/basic/jgiven-reports/io.holunda.testing.examples.basic.ApprovalProcessTest.json
@@ -2,620 +2,6 @@
"className": "io.holunda.testing.examples.basic.ApprovalProcessTest",
"name": "Approval Process",
"scenarios": [
- {
- "className": "io.holunda.testing.examples.basic.ApprovalProcessTest",
- "testMethodName": "should start asynchronously",
- "description": "should start asynchronously",
- "tagIds": [],
- "explicitParameters": [],
- "derivedParameters": [],
- "casesAsTable": false,
- "scenarioCases": [
- {
- "caseNr": 1,
- "steps": [
- {
- "name": "process $ is deployed",
- "words": [
- {
- "value": "Given",
- "isIntroWord": true
- },
- {
- "value": "process"
- },
- {
- "value": "approval",
- "argumentInfo": {
- "argumentName": "processDefinitionKey",
- "formattedValue": "\"approval\""
- }
- },
- {
- "value": "is deployed"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 339192620
- },
- {
- "name": "process is started for request",
- "words": [
- {
- "value": "When",
- "isIntroWord": true
- },
- {
- "value": "process is started for request"
- },
- {
- "value": "de9a9e2f-35d1-4efe-b01a-8812d4b83ac2",
- "argumentInfo": {
- "argumentName": "approvalRequestId",
- "formattedValue": "\"de9a9e2f-35d1-4efe-b01a-8812d4b83ac2\""
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 103293496
- },
- {
- "name": "process waits in $",
- "words": [
- {
- "value": "Then",
- "isIntroWord": true
- },
- {
- "value": "process waits in"
- },
- {
- "value": "start",
- "argumentInfo": {
- "argumentName": "activityId",
- "formattedValue": "\"start\""
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 32807927
- }
- ],
- "explicitArguments": [],
- "derivedArguments": [],
- "status": "SUCCESS",
- "durationInNanos": 565438735
- }
- ],
- "durationInNanos": 565438735,
- "executionStatus": "SUCCESS"
- },
- {
- "className": "io.holunda.testing.examples.basic.ApprovalProcessTest",
- "testMethodName": "should automatic approve",
- "description": "should automatic approve",
- "tagIds": [],
- "explicitParameters": [],
- "derivedParameters": [],
- "casesAsTable": false,
- "scenarioCases": [
- {
- "caseNr": 1,
- "steps": [
- {
- "name": "process $ is deployed",
- "words": [
- {
- "value": "Given",
- "isIntroWord": true
- },
- {
- "value": "process"
- },
- {
- "value": "approval",
- "argumentInfo": {
- "argumentName": "processDefinitionKey",
- "formattedValue": "\"approval\""
- }
- },
- {
- "value": "is deployed"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 20524822
- },
- {
- "name": "process is started for request",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "process is started for request"
- },
- {
- "value": "a06b2978-1d39-46c0-9abc-649c0e28892d",
- "argumentInfo": {
- "argumentName": "approvalRequestId",
- "formattedValue": "\"a06b2978-1d39-46c0-9abc-649c0e28892d\""
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 38517
- },
- {
- "name": "$approvalStrategy approval strategy can be applied",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "AUTOMATIC",
- "argumentInfo": {
- "argumentName": "approvalStrategy",
- "formattedValue": "\"AUTOMATIC\""
- }
- },
- {
- "value": "approval strategy can be applied"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 38820
- },
- {
- "name": "process continues",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "process continues"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 51485594
- },
- {
- "name": "automatic approval returns",
- "words": [
- {
- "value": "When",
- "isIntroWord": true
- },
- {
- "value": "automatic approval returns"
- },
- {
- "value": "APPROVE",
- "argumentInfo": {
- "argumentName": "approvalResult",
- "formattedValue": "APPROVE"
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 60883967
- },
- {
- "name": "process is finished",
- "words": [
- {
- "value": "Then",
- "isIntroWord": true
- },
- {
- "value": "process is finished"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 43493
- },
- {
- "name": "process has passed element(s) $",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "process has passed element(s)"
- },
- {
- "value": "service_auto_approve_request, end_approved",
- "argumentInfo": {
- "argumentName": "elements",
- "formattedValue": "\"service_auto_approve_request\", \"end_approved\""
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 50085041
- }
- ],
- "explicitArguments": [],
- "derivedArguments": [],
- "status": "SUCCESS",
- "durationInNanos": 283499983
- }
- ],
- "durationInNanos": 283499983,
- "executionStatus": "SUCCESS"
- },
- {
- "className": "io.holunda.testing.examples.basic.ApprovalProcessTest",
- "testMethodName": "should manually approve",
- "description": "should manually approve",
- "tagIds": [],
- "explicitParameters": [],
- "derivedParameters": [],
- "casesAsTable": false,
- "scenarioCases": [
- {
- "caseNr": 1,
- "steps": [
- {
- "name": "process $ is deployed",
- "words": [
- {
- "value": "Given",
- "isIntroWord": true
- },
- {
- "value": "process"
- },
- {
- "value": "approval",
- "argumentInfo": {
- "argumentName": "processDefinitionKey",
- "formattedValue": "\"approval\""
- }
- },
- {
- "value": "is deployed"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 38718
- },
- {
- "name": "process is started for request",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "process is started for request"
- },
- {
- "value": "d6256dae-04fa-40f1-8cee-3a3682779ca6",
- "argumentInfo": {
- "argumentName": "approvalRequestId",
- "formattedValue": "\"d6256dae-04fa-40f1-8cee-3a3682779ca6\""
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 34848
- },
- {
- "name": "$approvalStrategy approval strategy can be applied",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "MANUAL",
- "argumentInfo": {
- "argumentName": "approvalStrategy",
- "formattedValue": "\"MANUAL\""
- }
- },
- {
- "value": "approval strategy can be applied"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 28098
- },
- {
- "name": "process continues",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "process continues"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 35863
- },
- {
- "name": "process waits in $",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "process waits in"
- },
- {
- "value": "user_approve_request",
- "argumentInfo": {
- "argumentName": "activityId",
- "formattedValue": "\"user_approve_request\""
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 8003925
- },
- {
- "name": "task is completed with variables $",
- "words": [
- {
- "value": "When",
- "isIntroWord": true
- },
- {
- "value": "task is completed with variables"
- },
- {
- "value": "{\n approvalDecision \u003d\u003e Untyped value \u0027APPROVE\u0027, isTransient \u003d false\n}",
- "argumentInfo": {
- "argumentName": "variables"
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 59105152
- },
- {
- "name": "process is finished",
- "words": [
- {
- "value": "Then",
- "isIntroWord": true
- },
- {
- "value": "process is finished"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 38900
- },
- {
- "name": "process has passed element(s) $",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "process has passed element(s)"
- },
- {
- "value": "end_approved",
- "argumentInfo": {
- "argumentName": "elements",
- "formattedValue": "\"end_approved\""
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 7846950
- }
- ],
- "explicitArguments": [],
- "derivedArguments": [],
- "status": "SUCCESS",
- "durationInNanos": 158632830
- }
- ],
- "durationInNanos": 158632830,
- "executionStatus": "SUCCESS"
- },
- {
- "className": "io.holunda.testing.examples.basic.ApprovalProcessTest",
- "testMethodName": "should wait for automatic approve",
- "description": "should wait for automatic approve",
- "tagIds": [],
- "explicitParameters": [],
- "derivedParameters": [],
- "casesAsTable": false,
- "scenarioCases": [
- {
- "caseNr": 1,
- "steps": [
- {
- "name": "process $ is deployed",
- "words": [
- {
- "value": "Given",
- "isIntroWord": true
- },
- {
- "value": "process"
- },
- {
- "value": "approval",
- "argumentInfo": {
- "argumentName": "processDefinitionKey",
- "formattedValue": "\"approval\""
- }
- },
- {
- "value": "is deployed"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 38718
- },
- {
- "name": "process is started for request",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "process is started for request"
- },
- {
- "value": "c49bb7de-d665-4679-a29b-fb9d80f67ce2",
- "argumentInfo": {
- "argumentName": "approvalRequestId",
- "formattedValue": "\"c49bb7de-d665-4679-a29b-fb9d80f67ce2\""
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 44402
- },
- {
- "name": "$approvalStrategy approval strategy can be applied",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "AUTOMATIC",
- "argumentInfo": {
- "argumentName": "approvalStrategy",
- "formattedValue": "\"AUTOMATIC\""
- }
- },
- {
- "value": "approval strategy can be applied"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 1044647
- },
- {
- "name": "process continues",
- "words": [
- {
- "value": "When",
- "isIntroWord": true
- },
- {
- "value": "process continues"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 23664900
- },
- {
- "name": "process waits in $",
- "words": [
- {
- "value": "Then",
- "isIntroWord": true
- },
- {
- "value": "process waits in"
- },
- {
- "value": "service_auto_approve_request",
- "argumentInfo": {
- "argumentName": "activityId",
- "formattedValue": "\"service_auto_approve_request\""
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 36398
- },
- {
- "name": "external task exists on topic $topicName",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "external task exists on topic"
- },
- {
- "value": "approve-request",
- "argumentInfo": {
- "argumentName": "topicName",
- "formattedValue": "\"approve-request\""
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 4542751
- }
- ],
- "explicitArguments": [],
- "derivedArguments": [],
- "status": "SUCCESS",
- "durationInNanos": 79686227
- }
- ],
- "durationInNanos": 79686227,
- "executionStatus": "SUCCESS"
- },
- {
- "className": "io.holunda.testing.examples.basic.ApprovalProcessTest",
- "testMethodName": "should deploy",
- "description": "should deploy",
- "tagIds": [],
- "explicitParameters": [],
- "derivedParameters": [],
- "casesAsTable": false,
- "scenarioCases": [
- {
- "caseNr": 1,
- "steps": [
- {
- "name": "process $ is deployed",
- "words": [
- {
- "value": "Then",
- "isIntroWord": true
- },
- {
- "value": "process"
- },
- {
- "value": "approval",
- "argumentInfo": {
- "argumentName": "processDefinitionKey",
- "formattedValue": "\"approval\""
- }
- },
- {
- "value": "is deployed"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 26574920
- }
- ],
- "explicitArguments": [],
- "derivedArguments": [],
- "status": "SUCCESS",
- "durationInNanos": 27175006
- }
- ],
- "durationInNanos": 27175006,
- "executionStatus": "SUCCESS"
- },
{
"className": "io.holunda.testing.examples.basic.ApprovalProcessTest",
"testMethodName": "should manually reject",
@@ -650,7 +36,7 @@
}
],
"status": "PASSED",
- "durationInNanos": 38571
+ "durationInNanos": 14548485
},
{
"name": "process is started for request",
@@ -663,15 +49,15 @@
"value": "process is started for request"
},
{
- "value": "692f98eb-5666-466d-b40c-3ddb773b141e",
+ "value": "d22b5b69-98a2-45ab-95e3-d21b18918872",
"argumentInfo": {
"argumentName": "approvalRequestId",
- "formattedValue": "\"692f98eb-5666-466d-b40c-3ddb773b141e\""
+ "formattedValue": "\"d22b5b69-98a2-45ab-95e3-d21b18918872\""
}
}
],
"status": "PASSED",
- "durationInNanos": 37944
+ "durationInNanos": 82380
},
{
"name": "$approvalStrategy approval strategy can be applied",
@@ -692,7 +78,7 @@
}
],
"status": "PASSED",
- "durationInNanos": 29604
+ "durationInNanos": 55716
},
{
"name": "process continues",
@@ -706,7 +92,7 @@
}
],
"status": "PASSED",
- "durationInNanos": 41324
+ "durationInNanos": 47752
},
{
"name": "process waits in $",
@@ -727,7 +113,7 @@
}
],
"status": "PASSED",
- "durationInNanos": 40155
+ "durationInNanos": 46041
},
{
"name": "task\u0027s priority is between $lower and $upper",
@@ -758,7 +144,7 @@
}
],
"status": "PASSED",
- "durationInNanos": 41036
+ "durationInNanos": 49904
},
{
"name": "task\u0027s follow-up date is $ after its creation",
@@ -782,7 +168,7 @@
}
],
"status": "PASSED",
- "durationInNanos": 14874944
+ "durationInNanos": 17661886
},
{
"name": "task is completed with variables $",
@@ -797,12 +183,13 @@
{
"value": "{\n approvalDecision \u003d\u003e Untyped value \u0027REJECT\u0027, isTransient \u003d false\n}",
"argumentInfo": {
- "argumentName": "variables"
+ "argumentName": "variables",
+ "formattedValue": "{\n approvalDecision \u003d\u003e Untyped value \u0027REJECT\u0027, isTransient \u003d false\n}"
}
}
],
"status": "PASSED",
- "durationInNanos": 42984202
+ "durationInNanos": 67949846
},
{
"name": "process is finished",
@@ -816,7 +203,7 @@
}
],
"status": "PASSED",
- "durationInNanos": 68340
+ "durationInNanos": 63320
},
{
"name": "process has passed element(s) $",
@@ -837,174 +224,16 @@
}
],
"status": "PASSED",
- "durationInNanos": 5540256
- }
- ],
- "explicitArguments": [],
- "derivedArguments": [],
- "status": "SUCCESS",
- "durationInNanos": 154266280
- }
- ],
- "durationInNanos": 154266280,
- "executionStatus": "SUCCESS"
- },
- {
- "className": "io.holunda.testing.examples.basic.ApprovalProcessTest",
- "testMethodName": "should automatically reject",
- "description": "should automatically reject",
- "tagIds": [],
- "explicitParameters": [],
- "derivedParameters": [],
- "casesAsTable": false,
- "scenarioCases": [
- {
- "caseNr": 1,
- "steps": [
- {
- "name": "process $ is deployed",
- "words": [
- {
- "value": "Given",
- "isIntroWord": true
- },
- {
- "value": "process"
- },
- {
- "value": "approval",
- "argumentInfo": {
- "argumentName": "processDefinitionKey",
- "formattedValue": "\"approval\""
- }
- },
- {
- "value": "is deployed"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 38419
- },
- {
- "name": "process is started for request",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "process is started for request"
- },
- {
- "value": "02cffcdc-49d2-40b1-8dae-ecc328863ef6",
- "argumentInfo": {
- "argumentName": "approvalRequestId",
- "formattedValue": "\"02cffcdc-49d2-40b1-8dae-ecc328863ef6\""
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 39597
- },
- {
- "name": "$approvalStrategy approval strategy can be applied",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "AUTOMATIC",
- "argumentInfo": {
- "argumentName": "approvalStrategy",
- "formattedValue": "\"AUTOMATIC\""
- }
- },
- {
- "value": "approval strategy can be applied"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 37843
- },
- {
- "name": "process continues",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "process continues"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 27069319
- },
- {
- "name": "automatic approval returns",
- "words": [
- {
- "value": "When",
- "isIntroWord": true
- },
- {
- "value": "automatic approval returns"
- },
- {
- "value": "REJECT",
- "argumentInfo": {
- "argumentName": "approvalResult",
- "formattedValue": "REJECT"
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 29573477
- },
- {
- "name": "process is finished",
- "words": [
- {
- "value": "Then",
- "isIntroWord": true
- },
- {
- "value": "process is finished"
- }
- ],
- "status": "PASSED",
- "durationInNanos": 38214
- },
- {
- "name": "process has passed element(s) $",
- "words": [
- {
- "value": "and",
- "isIntroWord": true
- },
- {
- "value": "process has passed element(s)"
- },
- {
- "value": "service_auto_approve_request, end_rejected",
- "argumentInfo": {
- "argumentName": "elements",
- "formattedValue": "\"service_auto_approve_request\", \"end_rejected\""
- }
- }
- ],
- "status": "PASSED",
- "durationInNanos": 4268304
+ "durationInNanos": 51938513
}
],
"explicitArguments": [],
"derivedArguments": [],
"status": "SUCCESS",
- "durationInNanos": 110517780
+ "durationInNanos": 994767867
}
],
- "durationInNanos": 110517780,
+ "durationInNanos": 994767867,
"executionStatus": "SUCCESS"
}
],
diff --git a/examples/basic/pom.xml b/examples/basic/pom.xml
index 08f7c07..02a7822 100644
--- a/examples/basic/pom.xml
+++ b/examples/basic/pom.xml
@@ -6,7 +6,7 @@
io.holunda.testing
camunda-bpm-jgiven-examples
- 0.0.7
+ 0.0.8
camunda-bpm-jgiven-examples-basic
@@ -24,7 +24,7 @@
org.camunda.bpm.extension.mockito
camunda-bpm-mockito
- 4.13.0
+ 5.15.0
test
@@ -50,7 +50,7 @@
org.camunda.bpm.extension
camunda-bpm-process-test-coverage
- 0.3.2
+ 0.4.0
test
diff --git a/examples/basic/src/test/kotlin/io/holunda/testing/examples/basic/ApprovalProcessStages.kt b/examples/basic/src/test/kotlin/io/holunda/testing/examples/basic/ApprovalProcessStages.kt
index 68c7ac8..6b2fe7c 100644
--- a/examples/basic/src/test/kotlin/io/holunda/testing/examples/basic/ApprovalProcessStages.kt
+++ b/examples/basic/src/test/kotlin/io/holunda/testing/examples/basic/ApprovalProcessStages.kt
@@ -6,11 +6,11 @@ import com.tngtech.jgiven.annotation.Quoted
import io.holunda.camunda.bpm.extension.jgiven.JGivenProcessStage
import io.holunda.camunda.bpm.extension.jgiven.ProcessStage
import io.holunda.testing.examples.basic.ApprovalProcessBean.Expressions.APPROVE_REQUEST_TASK_LISTENER
-import io.holunda.testing.examples.basic.ApprovalProcessBean.Expressions.AUTOMATICALLY_APPROVE_REQUEST
import io.holunda.testing.examples.basic.ApprovalProcessBean.Expressions.DETERMINE_APPROVAL_STRATEGY
import io.holunda.testing.examples.basic.ApprovalProcessBean.Expressions.LOAD_APPROVAL_REQUEST
import io.holunda.testing.examples.basic.ApprovalProcessBean.Variables.APPROVAL_DECISION
import io.holunda.testing.examples.basic.ApprovalProcessBean.Variables.APPROVAL_STRATEGY
+import io.toolisticon.testing.jgiven.step
import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.assertThat
import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests.externalTask
import org.camunda.bpm.engine.test.mock.Mocks
@@ -22,7 +22,6 @@ import org.camunda.bpm.extension.mockito.CamundaMockito.registerJavaDelegateMock
@JGivenProcessStage
class ApprovalProcessActionStage : ProcessStage() {
-
@BeforeStage
fun mock_all_delegates() {
registerJavaDelegateMock(DETERMINE_APPROVAL_STRATEGY)
@@ -31,23 +30,20 @@ class ApprovalProcessActionStage : ProcessStage() {
- companion object {
- val processEngineRule = StandaloneInMemoryTestConfiguration().rule()
- }
+ companion object {
+ val processEngineRule: ProcessEngineRule = StandaloneInMemoryTestConfiguration().rule()
+ }
- @get: Rule
- @ScenarioState
- val camunda: ProcessEngineRule = processEngineRule
+ @get: Rule
+ @ScenarioState
+ val camunda: ProcessEngineRule = processEngineRule
- @Test
- fun `should deploy`() {
- then()
- .process_is_deployed(ApprovalProcessBean.KEY)
- }
+ @Test
+ fun `should deploy`() {
+ THEN
+ .process_is_deployed(ApprovalProcessBean.KEY)
+ }
- @Test
- fun `should start asynchronously`() {
+ @Test
+ fun `should start asynchronously`() {
- val approvalRequestId = UUID.randomUUID().toString()
+ val approvalRequestId = UUID.randomUUID().toString()
- given()
- .process_is_deployed(ApprovalProcessBean.KEY)
- whenever()
- .process_is_started_for_request(approvalRequestId)
- then()
- .process_waits_in(Elements.START)
- }
-
- @Test
- fun `should wait for automatic approve`() {
-
- val approvalRequestId = UUID.randomUUID().toString()
+ GIVEN
+ .process_is_deployed(ApprovalProcessBean.KEY)
+ WHEN
+ .process_is_started_for_request(approvalRequestId)
+ THEN
+ .process_waits_in(Elements.START)
+ }
+
+ @Test
+ fun `should wait for automatic approve`() {
+
+ val approvalRequestId = UUID.randomUUID().toString()
- given()
- .process_is_deployed(ApprovalProcessBean.KEY)
- .and()
- .process_is_started_for_request(approvalRequestId)
- .and()
- .approval_strategy_can_be_applied(Expressions.ApprovalStrategy.AUTOMATIC)
+ GIVEN
+ .process_is_deployed(ApprovalProcessBean.KEY)
+ .AND
+ .process_is_started_for_request(approvalRequestId)
+ .AND
+ .approval_strategy_can_be_applied(Expressions.ApprovalStrategy.AUTOMATIC)
- whenever()
- .process_continues()
-
- then()
- .process_waits_in(Elements.SERVICE_AUTO_APPROVE)
- .and()
- .external_task_exists("approve-request")
-
- }
-
- @Test
- fun `should automatic approve`() {
-
- val approvalRequestId = UUID.randomUUID().toString()
-
- given()
- .process_is_deployed(ApprovalProcessBean.KEY)
- .and()
- .process_is_started_for_request(approvalRequestId)
- .and()
- .approval_strategy_can_be_applied(Expressions.ApprovalStrategy.AUTOMATIC)
- .and()
- .process_continues()
-
- whenever()
- .automatic_approval_returns(Expressions.ApprovalDecision.APPROVE)
-
- then()
- .process_is_finished()
- .and()
- .process_has_passed(Elements.SERVICE_AUTO_APPROVE, Elements.END_APPROVED)
-
- }
-
-
- @Test
- fun `should automatically reject`() {
-
- val approvalRequestId = UUID.randomUUID().toString()
-
- given()
- .process_is_deployed(ApprovalProcessBean.KEY)
- .and()
- .process_is_started_for_request(approvalRequestId)
- .and()
- .approval_strategy_can_be_applied(Expressions.ApprovalStrategy.AUTOMATIC)
- .and()
- .process_continues()
-
- whenever()
- .automatic_approval_returns(Expressions.ApprovalDecision.REJECT)
-
- then()
- .process_is_finished()
- .and()
- .process_has_passed(Elements.SERVICE_AUTO_APPROVE, Elements.END_REJECTED)
-
- }
-
- @Test
- fun `should manually reject`() {
-
- val approvalRequestId = UUID.randomUUID().toString()
-
- given()
- .process_is_deployed(ApprovalProcessBean.KEY)
- .and()
- .process_is_started_for_request(approvalRequestId)
- .and()
- .approval_strategy_can_be_applied(Expressions.ApprovalStrategy.MANUAL)
- .and()
- .process_continues()
- .and()
- .process_waits_in(Elements.USER_APPROVE_REQUEST)
- .and()
- .task_priority_is_between(10, 30)
- .and()
- .task_has_follow_up_date_after(Period.ofDays(1))
-
- whenever()
- .task_is_completed_with_variables(
- putValue(ApprovalProcessBean.Variables.APPROVAL_DECISION, Expressions.ApprovalDecision.REJECT),
- isAsyncAfter = true
- )
-
- then()
- .process_is_finished()
- .and()
- .process_has_passed(Elements.END_REJECTED)
-
- }
-
- @Test
- fun `should manually approve`() {
-
- val approvalRequestId = UUID.randomUUID().toString()
-
- given()
- .process_is_deployed(ApprovalProcessBean.KEY)
- .and()
- .process_is_started_for_request(approvalRequestId)
- .and()
- .approval_strategy_can_be_applied(Expressions.ApprovalStrategy.MANUAL)
- .and()
- .process_continues()
- .and()
- .process_waits_in(Elements.USER_APPROVE_REQUEST)
-
- whenever()
- .task_is_completed_with_variables(
- putValue(ApprovalProcessBean.Variables.APPROVAL_DECISION, Expressions.ApprovalDecision.APPROVE),
- isAsyncAfter = true
- )
-
- then()
- .process_is_finished()
- .and()
- .process_has_passed(Elements.END_APPROVED)
-
- }
+ WHEN
+ .process_continues()
+
+ THEN
+ .process_waits_in(Elements.SERVICE_AUTO_APPROVE)
+ .AND
+ .external_task_exists("approve-request")
+
+ }
+
+ @Test
+ fun `should automatic approve`() {
+
+ val approvalRequestId = UUID.randomUUID().toString()
+
+ GIVEN
+ .process_is_deployed(ApprovalProcessBean.KEY)
+ .AND
+ .process_is_started_for_request(approvalRequestId)
+ .AND
+ .approval_strategy_can_be_applied(Expressions.ApprovalStrategy.AUTOMATIC)
+ .AND
+ .process_continues()
+
+ WHEN
+ .automatic_approval_returns(Expressions.ApprovalDecision.APPROVE)
+
+ THEN
+ .process_is_finished()
+ .AND
+ .process_has_passed(Elements.SERVICE_AUTO_APPROVE, Elements.END_APPROVED)
+
+ }
+
+
+ @Test
+ fun `should automatically reject`() {
+
+ val approvalRequestId = UUID.randomUUID().toString()
+
+ GIVEN
+ .process_is_deployed(ApprovalProcessBean.KEY)
+ .AND
+ .process_is_started_for_request(approvalRequestId)
+ .AND
+ .approval_strategy_can_be_applied(Expressions.ApprovalStrategy.AUTOMATIC)
+ .AND
+ .process_continues()
+
+ WHEN
+ .automatic_approval_returns(Expressions.ApprovalDecision.REJECT)
+
+ THEN
+ .process_is_finished()
+ .AND
+ .process_has_passed(Elements.SERVICE_AUTO_APPROVE, Elements.END_REJECTED)
+
+ }
+
+ @Test
+ fun `should manually reject`() {
+
+ val approvalRequestId = UUID.randomUUID().toString()
+
+ GIVEN
+ .process_is_deployed(ApprovalProcessBean.KEY)
+ .AND
+ .process_is_started_for_request(approvalRequestId)
+ .AND
+ .approval_strategy_can_be_applied(Expressions.ApprovalStrategy.MANUAL)
+ .AND
+ .process_continues()
+ .AND
+ .process_waits_in(Elements.USER_APPROVE_REQUEST)
+ .AND
+ .task_priority_is_between(10, 30)
+ .AND
+ .task_has_follow_up_date_after(Period.ofDays(1))
+
+ WHEN
+ .task_is_completed_with_variables(
+ putValue(ApprovalProcessBean.Variables.APPROVAL_DECISION, Expressions.ApprovalDecision.REJECT),
+ isAsyncAfter = true
+ )
+
+ THEN
+ .process_is_finished()
+ .AND
+ .process_has_passed(Elements.END_REJECTED)
+
+ }
+
+ @Test
+ fun `should manually approve`() {
+
+ val approvalRequestId = UUID.randomUUID().toString()
+
+ GIVEN
+ .process_is_deployed(ApprovalProcessBean.KEY)
+ .AND
+ .process_is_started_for_request(approvalRequestId)
+ .AND
+ .approval_strategy_can_be_applied(Expressions.ApprovalStrategy.MANUAL)
+ .AND
+ .process_continues()
+ .AND
+ .process_waits_in(Elements.USER_APPROVE_REQUEST)
+
+ WHEN
+ .task_is_completed_with_variables(
+ putValue(ApprovalProcessBean.Variables.APPROVAL_DECISION, Expressions.ApprovalDecision.APPROVE),
+ isAsyncAfter = true
+ )
+
+ THEN
+ .process_is_finished()
+ .AND
+ .process_has_passed(Elements.END_APPROVED)
+
+ }
}
diff --git a/examples/pom.xml b/examples/pom.xml
index 3b598e8..5b35fda 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -6,14 +6,14 @@
io.holunda.testing
camunda-bpm-jgiven-parent
- 0.0.7
+ 0.0.8
camunda-bpm-jgiven-examples
pom
- 2.4.4
+ 2.4.5
diff --git a/extension/pom.xml b/extension/pom.xml
index 4508541..7735834 100644
--- a/extension/pom.xml
+++ b/extension/pom.xml
@@ -6,7 +6,7 @@
io.holunda.testing
camunda-bpm-jgiven-parent
- 0.0.7
+ 0.0.8
camunda-bpm-jgiven
@@ -28,6 +28,10 @@
jgiven-html5-report
${jgiven.version}
+
+ io.toolisticon.testing
+ jgiven-kotlin
+
diff --git a/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ProcessStage.kt b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ProcessStage.kt
index a2efd6a..123903f 100644
--- a/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ProcessStage.kt
+++ b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/ProcessStage.kt
@@ -5,6 +5,7 @@ import com.tngtech.jgiven.annotation.*
import com.tngtech.jgiven.base.ScenarioTestBase
import io.holunda.camunda.bpm.extension.jgiven.formatter.QuotedVarargs
import io.holunda.camunda.bpm.extension.jgiven.formatter.VariableMapFormat
+import io.toolisticon.testing.jgiven.step
import org.assertj.core.api.Assertions.*
import org.camunda.bpm.engine.runtime.ProcessInstance
import org.camunda.bpm.engine.test.ProcessEngineRule
@@ -18,24 +19,27 @@ import java.util.function.Supplier
/**
* Alias for the when
*/
+@Deprecated(message = "Please use JGiven-Kotlin instead")
fun ScenarioTestBase.whenever() = `when`()
/**
* Alias for the when
*/
+@Deprecated(message = "Please use JGiven-Kotlin instead")
fun ScenarioTestBase.WHEN() = `when`()
/**
* Alias for the given
*/
+@Deprecated(message = "Please use JGiven-Kotlin instead")
fun ScenarioTestBase.GIVEN() = given()
/**
* Alias for the then
*/
+@Deprecated(message = "Please use JGiven-Kotlin instead")
fun ScenarioTestBase.THEN() = then()
-
/**
* Annotation to mark jgiven process stages in order to make them open by all-open compiler plugin.
*/
@@ -66,9 +70,8 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("process waits in $")
- fun process_waits_in(@Quoted activityId: String): SELF {
+ fun process_waits_in(@Quoted activityId: String): SELF = step {
assertThat(processInstanceSupplier.get()).isWaitingAt(activityId)
- return self()
}
/**
@@ -77,7 +80,7 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("process $ is deployed")
- fun process_is_deployed(@Quoted processDefinitionKey: String): SELF {
+ fun process_is_deployed(@Quoted processDefinitionKey: String): SELF = step {
assertThat(
camunda.repositoryService
.createProcessDefinitionQuery()
@@ -85,16 +88,15 @@ class ProcessStage, PROCESS_BEAN : Suppl
.latestVersion()
.singleResult()
).isNotNull
- return self()
+
}
/**
* Asserts that the process is finished.
* @return fluent stage.
*/
- fun process_is_finished(): SELF {
+ fun process_is_finished(): SELF = step {
assertThat(processInstanceSupplier.get()).isEnded
- return self()
}
/**
@@ -103,9 +105,8 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("process has passed element(s) $")
- fun process_has_passed(@QuotedVarargs vararg elements: String): SELF {
+ fun process_has_passed(@QuotedVarargs vararg elements: String): SELF = step {
assertThat(processInstanceSupplier.get()).hasPassedInOrder(*elements)
- return self()
}
/**
@@ -114,9 +115,8 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("process has not passed element(s) $")
- fun process_has_not_passed(@QuotedVarargs vararg elements: String): SELF {
+ fun process_has_not_passed(@QuotedVarargs vararg elements: String): SELF = step {
assertThat(processInstanceSupplier.get()).hasNotPassed(*elements)
- return self()
}
/**
@@ -124,9 +124,8 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @param user username of the assignee.
* @return fluent stage.
*/
- fun task_is_assigned_to_user(@Quoted user: String): SELF {
+ fun task_is_assigned_to_user(@Quoted user: String): SELF = step {
assertThat(task()).isAssignedTo(user)
- return self()
}
/**
@@ -134,10 +133,9 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @param users list of candidate users that must be candidate.
* @return fluent stage.
*/
- fun task_is_visible_to_users(@QuotedVarargs users: Array): SELF {
+ fun task_is_visible_to_users(@QuotedVarargs users: Array): SELF = step {
val task = task()
- Arrays.stream(users).forEach { user -> assertThat(task).hasCandidateUser(user) }
- return self()
+ users.forEach { user -> assertThat(task).hasCandidateUser(user) }
}
/**
@@ -145,10 +143,9 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @param groups list of candidate groups that must be candidate.
* @return fluent stage.
*/
- fun task_is_visible_to_groups(@QuotedVarargs groups: Array): SELF {
+ fun task_is_visible_to_groups(@QuotedVarargs groups: Array): SELF = step {
val task = task()
- Arrays.stream(groups).forEach { group -> assertThat(task).hasCandidateGroup(group) }
- return self()
+ groups.forEach { group -> assertThat(task).hasCandidateGroup(group) }
}
/**
@@ -157,13 +154,12 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("task's follow-up date is $ after its creation")
- fun task_has_follow_up_date_after(followUpDatePeriod: Period): SELF {
+ fun task_has_follow_up_date_after(followUpDatePeriod: Period): SELF = step {
assertThat(task().followUpDate).isInSameSecondWindowAs(
Date.from(
task().createTime.toInstant().plus(followUpDatePeriod)
)
)
- return self()
}
/**
@@ -172,11 +168,10 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("task's priority is $")
- fun task_has_priority(priority: Int): SELF {
+ fun task_has_priority(priority: Int): SELF = step {
assertThat(task().priority)
.`as`("Expecting task priority to be %d, but it was %d.", priority, task().priority)
.isEqualTo(priority)
- return self()
}
/**
@@ -185,11 +180,10 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("task's priority is not $")
- fun task_has_priority_other_than(priority: Int): SELF {
+ fun task_has_priority_other_than(priority: Int): SELF = step {
assertThat(task().priority)
.`as`("Expecting task priority to not equal to %d, but it was %d.", priority, task().priority)
.isNotEqualTo(priority)
- return self()
}
/**
@@ -198,11 +192,10 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("task's priority is greater than $")
- fun task_has_priority_greater_than(priority: Int): SELF {
+ fun task_has_priority_greater_than(priority: Int): SELF = step {
assertThat(task().priority)
.`as`("Expecting task priority to be greater than %d, but it was %d.", priority, task().priority)
.isGreaterThan(priority)
- return self()
}
/**
@@ -211,11 +204,10 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("task's priority is less than $")
- fun task_has_priority_less_than(priority: Int): SELF {
+ fun task_has_priority_less_than(priority: Int): SELF = step {
assertThat(task().priority)
.`as`("Expecting task priority to be less than %d, but it was %d.", priority, task().priority)
.isLessThan(priority)
- return self()
}
/**
@@ -225,11 +217,10 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("task's priority is between \$lower and \$upper")
- fun task_priority_is_between(lower: Int = 0, upper: Int = 100): SELF {
+ fun task_priority_is_between(lower: Int = 0, upper: Int = 100): SELF = step {
assertThat(task().priority)
.`as`("Expecting task priority to be between %d and %d, but it was %d.", lower, upper, task().priority)
.isBetween(lower, upper)
- return self()
}
/**
@@ -239,10 +230,9 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("variable \$variableName is set to \$value")
- fun variable_is_set(@Quoted variableName: String, @Quoted value: Any): SELF {
+ fun variable_is_set(@Quoted variableName: String, @Quoted value: Any): SELF = step {
assertThat(processInstanceSupplier.get()).hasVariables(variableName)
assertThat(processInstanceSupplier.get()).variables().containsEntry(variableName, value)
- return self()
}
/**
@@ -251,11 +241,10 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("variables $ are not present")
- fun variable_is_not_present(@QuotedVarargs vararg variableName: String): SELF {
+ fun variable_is_not_present(@QuotedVarargs vararg variableName: String): SELF = step {
assertThat(processInstanceSupplier.get())
.`as`("variable $variableName should not be present")
.variables().doesNotContainKeys(*variableName)
- return self()
}
/**
@@ -264,9 +253,8 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("task is completed with variables $")
- fun task_is_completed_with_variables(@VariableMapFormat variables: VariableMap = createVariables()): SELF {
+ fun task_is_completed_with_variables(@VariableMapFormat variables: VariableMap = createVariables()): SELF = step {
task_is_completed_with_variables(variables, false)
- return self()
}
/**
@@ -280,7 +268,7 @@ class ProcessStage, PROCESS_BEAN : Suppl
fun task_is_completed_with_variables(
@VariableMapFormat variables: VariableMap = createVariables(),
@Hidden isAsyncAfter: Boolean = false
- ): SELF {
+ ): SELF = step {
val taskDefinitionKey = task().taskDefinitionKey
taskService().complete(task().id, variables)
if (isAsyncAfter) {
@@ -289,26 +277,23 @@ class ProcessStage, PROCESS_BEAN : Suppl
.isWaitingAt(taskDefinitionKey)
execute(job())
}
- return self()
}
/**
* No op.
* @return fluent stage.
*/
- fun no_job_is_executed(): SELF {
+ fun no_job_is_executed(): SELF = step {
// empty
- return self()
}
/**
* Executes current job.
* @return fluent stage.
*/
- fun job_is_executed(): SELF {
+ fun job_is_executed(): SELF = step {
assertThat(processInstanceSupplier.get()).isNotNull
execute(job())
- return self()
}
/**
@@ -316,10 +301,9 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("process continues")
- fun process_continues(): SELF {
+ fun process_continues(): SELF = step {
assertThat(processInstanceSupplier.get()).isNotNull
execute(job())
- return self()
}
/**
@@ -328,14 +312,13 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("external task exists on topic \$topicName")
- fun external_task_exists(@Quoted topicName: String): SELF {
+ fun external_task_exists(@Quoted topicName: String): SELF = step {
val externalTasks = camunda
.externalTaskService
.createExternalTaskQuery()
.topicName(topicName)
.list()
assertThat(externalTasks).isNotEmpty
- return self()
}
/**
@@ -348,10 +331,8 @@ class ProcessStage, PROCESS_BEAN : Suppl
fun external_task_is_completed(
@Quoted topicName: String,
@VariableMapFormat variables: VariableMap = createVariables()
- ): SELF {
+ ): SELF = step {
external_task_is_completed(topicName, variables, false)
-
- return self()
}
/**
@@ -366,7 +347,7 @@ class ProcessStage, PROCESS_BEAN : Suppl
@Quoted topicName: String,
@VariableMapFormat variables: VariableMap = createVariables(),
isAsyncAfter: Boolean = false
- ): SELF {
+ ): SELF = step {
camunda
.externalTaskService
.fetchAndLock(10, "test-worker")
@@ -382,8 +363,6 @@ class ProcessStage, PROCESS_BEAN : Suppl
if (isAsyncAfter) {
process_continues()
}
-
- return self()
}
/**
@@ -393,7 +372,7 @@ class ProcessStage, PROCESS_BEAN : Suppl
* @return fluent stage.
*/
@As("message \$messageName is received setting variables \$variables")
- fun message_is_received(@Quoted messageName: String, variables: VariableMap = createVariables()): SELF {
+ fun message_is_received(@Quoted messageName: String, variables: VariableMap = createVariables()): SELF = step {
// exactly one subscription
assertThat(
@@ -408,8 +387,6 @@ class ProcessStage, PROCESS_BEAN : Suppl
.createMessageCorrelation(messageName)
.setVariables(variables)
.correlate()
-
- return self()
}
}
diff --git a/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/formatter/VariableMapFormat.kt b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/formatter/VariableMapFormat.kt
index 2fdfb85..ab63be6 100644
--- a/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/formatter/VariableMapFormat.kt
+++ b/extension/src/main/kotlin/io/holunda/camunda/bpm/extension/jgiven/formatter/VariableMapFormat.kt
@@ -18,12 +18,12 @@ import org.camunda.bpm.engine.variable.value.TypedValue
*/
@MustBeDocumented
@Table(
- formatter = VariableMapTableFormatter.Factory::class,
- rowFormatter = EntryRowFormatter.Factory::class,
- columnTitles = ["Name", "Value", "Transient"],
- header = Table.HeaderType.HORIZONTAL
+ formatter = VariableMapTableFormatter.Factory::class,
+ rowFormatter = EntryRowFormatter.Factory::class,
+ columnTitles = ["Name", "Value", "Transient"],
+ header = Table.HeaderType.HORIZONTAL
)
-@Retention(AnnotationRetention.RUNTIME)
+@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.FIELD)
annotation class VariableMapFormat
@@ -32,22 +32,24 @@ annotation class VariableMapFormat
* @param formatterConfiguration config.
* @param objectFormatter formatter for single objects.
*/
-class VariableMapTableFormatter(formatterConfiguration: FormatterConfiguration, objectFormatter: ObjectFormatter<*>) : DefaultTableFormatter(formatterConfiguration, objectFormatter) {
+class VariableMapTableFormatter(formatterConfiguration: FormatterConfiguration, objectFormatter: ObjectFormatter<*>) :
+ DefaultTableFormatter(formatterConfiguration, objectFormatter) {
- /**
- * Factory.
- */
- class Factory : TableFormatterFactory {
- override fun create(formatterConfiguration: FormatterConfiguration, objectFormatter: ObjectFormatter<*>) = VariableMapTableFormatter(formatterConfiguration, objectFormatter)
+ // FIXME: if we use meta-annotation, specify it here.
+ override fun format(argument: Any, tableAnnotation: Table, parameterName: String, vararg allAnnotations: Annotation): DataTable {
+ return if (argument is VariableMap) {
+ super.format(argument.entries, tableAnnotation, parameterName, *allAnnotations)
+ } else {
+ super.format(argument, tableAnnotation, parameterName, *allAnnotations)
}
+ }
- override fun format(tableArgument: Any, tableAnnotation: Table, parameterName: String, vararg allAnnotations: Annotation): DataTable {
- return if (tableArgument is VariableMap) {
- super.format(tableArgument.entries, tableAnnotation, parameterName, *allAnnotations)
- } else {
- super.format(tableArgument, tableAnnotation, parameterName, *allAnnotations)
- }
- }
+ /**
+ * Factory.
+ */
+ class Factory : TableFormatterFactory {
+ override fun create(formatterConfiguration: FormatterConfiguration, objectFormatter: ObjectFormatter<*>) = VariableMapTableFormatter(formatterConfiguration, objectFormatter)
+ }
}
/**
@@ -56,39 +58,46 @@ class VariableMapTableFormatter(formatterConfiguration: FormatterConfiguration,
*/
class EntryRowFormatter(private val tableAnnotation: Table) : RowFormatter() {
- /**
- * Object formatter.
- */
- private val formatter: ObjectFormatter = DefaultFormatter.INSTANCE
+ /**
+ * Object formatter.
+ */
+ private val formatter: ObjectFormatter = DefaultFormatter.INSTANCE
- override fun header(): MutableList {
- return tableAnnotation.columnTitles.toMutableList()
- }
+ override fun header(): MutableList {
+ return tableAnnotation.columnTitles.toMutableList()
+ }
- override fun formatRow(row: Any?): MutableList {
- val columns = mutableListOf()
- if (row is Map.Entry<*, *>) {
- columns.add(formatter.format(row.key))
- val value = row.value
- if (value is TypedValue) {
- columns.add(formatter.format(value.value))
- columns.add(formatter.format(value.isTransient))
- } else {
- columns.add(formatter.format(value))
- columns.add("n/a")
- }
- } else {
- columns.add(formatter.format(row))
- }
- return columns
+ override fun formatRow(row: Any?): MutableList {
+ val columns = mutableListOf()
+ if (row is Map.Entry<*, *>) {
+ columns.add(formatter.format(row.key))
+ val value = row.value
+ if (value is TypedValue) {
+ columns.add(formatter.format(value.value))
+ columns.add(formatter.format(value.isTransient))
+ } else {
+ columns.add(formatter.format(value))
+ columns.add("n/a")
+ }
+ } else {
+ columns.add(formatter.format(row))
}
+ return columns
+ }
- /**
- * Factory.
- */
- class Factory : RowFormatterFactory {
- override fun create(parameterType: Class<*>, parameterName: String, tableAnnotation: Table, annotations: Array, configuration: FormatterConfiguration, objectFormatter: ObjectFormatter<*>): RowFormatter {
- return EntryRowFormatter(tableAnnotation)
- }
+ /**
+ * Factory.
+ */
+ class Factory : RowFormatterFactory {
+ override fun create(
+ parameterType: Class<*>,
+ parameterName: String,
+ tableAnnotation: Table,
+ annotations: Array,
+ configuration: FormatterConfiguration,
+ objectFormatter: ObjectFormatter<*>
+ ): RowFormatter {
+ return EntryRowFormatter(tableAnnotation)
}
+ }
}
diff --git a/pom.xml b/pom.xml
index 34e48eb..908ff53 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
io.holunda.testing
camunda-bpm-jgiven-parent
- 0.0.7
+ 0.0.8
pom
@@ -17,11 +17,13 @@
7.15.0
1.0.0
- 4.13.1
- 3.16.1
+ 4.13.2
+ 3.19.0
10.0.0
+ 1.0.0
+
11
- 1.4.31
+ 1.5.0
true
2.0.3
${java.version}
@@ -55,6 +57,11 @@
jgiven-spring
${jgiven.version}
+
+ com.tngtech.jgiven
+ jgiven-spring-junit4
+ ${jgiven.version}
+
com.tngtech.jgiven
jgiven-html5-report
@@ -65,6 +72,11 @@
assertj-core
${assertj.version}
+
+ io.toolisticon.testing
+ jgiven-kotlin
+ ${jgiven-kotlin.version}
+
org.camunda.bpm
camunda-engine
@@ -125,7 +137,7 @@
3.6.0
- 11
+ ${java.version}
@@ -147,8 +159,8 @@
3.8.1
UTF-8
-
- 1.8
+
+ ${java.version}
@@ -182,7 +194,7 @@
org.apache.maven.plugins
maven-resources-plugin
- 3.1.0
+ 3.2.0
UTF-8
@@ -192,7 +204,7 @@
com.amashchenko.maven.plugin
gitflow-maven-plugin
- 1.14.0
+ 1.16.0
master
@@ -286,7 +298,7 @@
org.jetbrains.dokka
dokka-maven-plugin
- 1.4.30
+ 1.4.32
test
@@ -342,7 +354,7 @@
org.apache.maven.plugins
maven-gpg-plugin
- 1.6
+ 3.0.1
--batch
@@ -459,7 +471,7 @@
Apache License, Version 2.0
- http://www.apache.org/licenses/LICENSE-2.0.txt
+ https://www.apache.org/licenses/LICENSE-2.0.txt
repo