This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from sbtqa/rest-param-placeholders
add replace placeholders in params value ability
- Loading branch information
Showing
7 changed files
with
133 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...rc/test/java/ru/sbtqa/tag/api/entries/apirequest/WithParamsPlaceholdersEndpointEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package ru.sbtqa.tag.api.entries.apirequest; | ||
|
||
import cucumber.api.DataTable; | ||
import java.util.Map; | ||
import ru.sbtqa.tag.api.EndpointEntry; | ||
import ru.sbtqa.tag.api.Rest; | ||
import ru.sbtqa.tag.api.annotation.Endpoint; | ||
import ru.sbtqa.tag.api.annotation.Header; | ||
import ru.sbtqa.tag.api.annotation.Query; | ||
import ru.sbtqa.tag.api.annotation.Validation; | ||
import ru.sbtqa.tag.api.utils.Default; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
@Endpoint(method = Rest.GET, path = "client/get-with-params-placeholder", title = "api request with params test placeholders") | ||
public class WithParamsPlaceholdersEndpointEntry extends EndpointEntry { | ||
|
||
@Query(name = Default.QUERY_PARAMETER_NAME_1) | ||
private String query = "new-${parameter-1}"; | ||
|
||
@Header(name = Default.HEADER_PARAMETER_NAME_1) | ||
private String header = "[{\"value\":\"${parameter-2}\", \"visible\":true, \"name\":\"${parameter-3}\"}]"; | ||
|
||
@Header(name = "header2") | ||
private String header2; | ||
|
||
@Validation(title = "result with datatable placeholders") | ||
public void validate(DataTable dataTable) { | ||
validate(dataTable.asMap(String.class, String.class)); | ||
} | ||
|
||
@Validation(title = "result with map placeholders") | ||
public void validate(Map<String, String> data) { | ||
String expectedResult = data.get(Default.QUERY_PARAMETER_NAME_1) + data.get(Default.HEADER_PARAMETER_NAME_1) + data.get("header2"); | ||
getResponse().body("result", equalTo(expectedResult)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters