-
Notifications
You must be signed in to change notification settings - Fork 14
π 3λ¨κ³ - μΈλΆ μμ€ν 격리 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: stonehee99
Are you sure you want to change the base?
Changes from all commits
66e6208
32ab59c
1163d7e
f992fbf
f8c9359
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "priority": 20, | ||
| "request": { | ||
| "method": "POST", | ||
| "urlPath": "/v1/payments/confirm", | ||
| "headers": { | ||
| "Authorization": { "equalTo": "Basic dGVzdF9za19kdW1teTo=" }, | ||
| "Content-Type": { "contains": "application/json" } | ||
| }, | ||
| "bodyPatterns": [ | ||
| { "matchesJsonPath": "$.paymentKey" }, | ||
| { "matchesJsonPath": "$.orderId" }, | ||
| { "matchesJsonPath": "$.amount" } | ||
| ] | ||
| }, | ||
| "response": { | ||
| "status": 200, | ||
| "headers": { "Content-Type": "application/json" }, | ||
| "jsonBody": { | ||
| "paymentKey": "{{jsonPath request.body '$.paymentKey'}}", | ||
| "orderId": "{{jsonPath request.body '$.orderId'}}", | ||
| "method": "CARD", | ||
| "approvedAt": "2024-01-01T12:34:56Z", | ||
| "totalAmount": "{{jsonPath request.body '$.amount'}}", | ||
| "status": "APPROVED", | ||
| "receipt": { "url": "https://pay.local/receipts/{{jsonPath request.body '$.paymentKey'}}" } | ||
| }, | ||
| "transformers": ["response-template"] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "priority": 19, | ||
| "request": { | ||
| "method": "POST", | ||
| "urlPath": "/v1/payments/confirm", | ||
| "headers": { "Authorization": { "equalTo": "Basic dGVzdF9za19kdW1teTo=" } }, | ||
| "bodyPatterns": [ { "matchesJsonPath": "$[?(@.amount == 99999)]" } ] | ||
| }, | ||
| "response": { | ||
| "status": 409, | ||
| "headers": { "Content-Type": "application/json" }, | ||
| "jsonBody": { "code": "AMOUNT_MISMATCH", "message": "amount/orderId mismatch" } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| package com.camping.tests.steps; | ||
|
|
||
| import static io.restassured.RestAssured.given; | ||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import io.cucumber.java.PendingException; | ||
| import io.cucumber.java.en.Given; | ||
| import io.cucumber.java.en.Then; | ||
| import io.cucumber.java.en.When; | ||
| import io.restassured.response.Response; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import org.apache.http.HttpStatus; | ||
|
|
||
| public class KioskPaymentStepDef { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μ΄ ν μ€νΈ μ μ₯μμλ ν€μ€μ€ν¬ μΈ μ¬μ©μ μμ½κ³Ό κ΄λ¦¬μλ‘ νΈμΆνλ ν μ€νΈλ ν¬ν¨λλ μ μ₯μμ λλ€! νμ¬ ν€μ€μ€ν¬λ‘ νΈμΆμ 보λ΄λ μ€ν
μ΄ KioskProductStepsκ³Ό KioskPaymentStepDefμ μμΉν΄μλλ°μ~
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. κΈ°μ‘΄ 2μ£Όμ°¨ λ―Έμ μμ νλ κ² μ²λΌ API νΈμΆ μ± μμ κ°μ§ ν΄λμ€λ₯Ό λ§λ€μ΄λ³΄λ©΄ μ’κ² λ€μ! |
||
|
|
||
| private int amount; | ||
| private Response response; | ||
|
Comment on lines
+17
to
+18
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. μ€ν
ν΄λμ€λ³λ‘ 곡μ νλ κ°μ²΄κ° λ°λ‘ κ΄λ¦¬λκ³ μλλ°μ~ |
||
|
|
||
| @Given("κ²°μ κΈμ‘μ΄ {int}μμΈ μ₯λ°κ΅¬λκ° μλ€") | ||
| public void κ²°μ κΈμ‘μ΄μμΈμ₯λ°κ΅¬λκ°μλ€(int amount) { | ||
| this.amount = amount; | ||
| } | ||
|
|
||
| @When("κ²°μ ν€ {string} μ μ£Όλ¬Έλ²νΈ {string} λ‘ κ²°μ μΉμΈμ μμ²νλ€") | ||
| public void κ²°μ ν€μμ£Όλ¬Έλ²νΈλ‘κ²°μ μΉμΈμμμ²νλ€(String paymentKey, String orderId) { | ||
| Map<String, Object> body = Map.of( | ||
| "paymentKey", paymentKey, | ||
| "orderId", orderId, | ||
| "amount", amount, | ||
| "items", List.of(Map.of( | ||
| "productId", 1, | ||
| "quantity", 1, | ||
| "lineTotal", amount | ||
| )) | ||
| ); | ||
|
|
||
| response = given() | ||
| .contentType("application/json") | ||
| .body(body) | ||
| .when().post("http://localhost:8080/api/payments/confirm") | ||
| .then().extract().response(); | ||
| } | ||
|
|
||
|
|
||
| @Then("κ²°μ κ° μ±κ³΅νλ©° κ²°μ κΈμ‘μ {int}μμ΄λ€") | ||
| public void κ²°μ κ°μ±κ³΅νλ©°κ²°μ κΈμ‘μμμ΄λ€(int expectedAmount) { | ||
| assertThat(response.statusCode()).isEqualTo(HttpStatus.SC_OK); | ||
| boolean success = response.jsonPath().getBoolean("success"); | ||
| int paid = response.jsonPath().getInt("paidAmount"); | ||
| assertThat(success).isTrue(); | ||
| assertThat(paid).isEqualTo(expectedAmount); | ||
| } | ||
|
|
||
| @Then("κ²°μ κ° μ€ν¨νλ€.") | ||
| public void κ²°μ κ°μ€ν¨νλ€() { | ||
| assertThat(response.statusCode()).isEqualTo(HttpStatus.SC_OK); | ||
| boolean success = response.jsonPath().getBoolean("success"); | ||
| assertThat(success).isFalse(); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Feature: ν€μ€μ€ν¬ κ²°μ μΉμΈ E2E ν μ€νΈ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. kiosk - paymeny(wiremock) e2e ν μ€νΈ π |
||
|
|
||
| Scenario: κ²°μ μΉμΈμ μμ²νλ©΄ κ²°μ κ° μ μ μΉμΈλλ€. | ||
| Given κ²°μ κΈμ‘μ΄ 10000μμΈ μ₯λ°κ΅¬λκ° μλ€ | ||
| When κ²°μ ν€ "pay_123" μ μ£Όλ¬Έλ²νΈ "ord_123" λ‘ κ²°μ μΉμΈμ μμ²νλ€ | ||
| Then κ²°μ κ° μ±κ³΅νλ©° κ²°μ κΈμ‘μ 10000μμ΄λ€ | ||
|
|
||
| Scenario: κ²°μ μΉμΈμ μμ²νλ©΄ κ²°μ κ° μ€ν¨νλ€. | ||
| Given κ²°μ κΈμ‘μ΄ 99999μμΈ μ₯λ°κ΅¬λκ° μλ€ | ||
| When κ²°μ ν€ "pay_fail" μ μ£Όλ¬Έλ²νΈ "ord_fail" λ‘ κ²°μ μΉμΈμ μμ²νλ€ | ||
| Then κ²°μ κ° μ€ν¨νλ€. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
νΌλλ°± λ°μ π