Created
July 26, 2018 05:40
-
-
Save ToshiDono/d5bdf67054e4e954948208e28560fdbe to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| @BeforeMethod | |
| public void start(){ | |
| RestAssured.baseURI = "https://dictionary.yandex.net/api/v1/dicservice.json"; | |
| } | |
| @DataProvider | |
| public Object[][] dictionary(){ | |
| return new Object[][] { | |
| {"Привет","hallo"} | |
| }; | |
| } | |
| @Test(dataProvider = "dictionary") | |
| public void lookupTest(String text, String answer){ | |
| String path = getPathFormated(API_KEY, text, LANGUAGE_FORMAT); | |
| RestAssured.useRelaxedHTTPSValidation(); | |
| String json = given() | |
| .header("User-Agent", "Mozilla...") | |
| .header("JWT", "jwt_token") | |
| .when() | |
| .get(EndpointURI.LOOKUP.addPath(path)).andReturn().body().print(); | |
| // .then() | |
| // .statusCode(200) | |
| // .body("def[0].tr[0].syn[1].text", equalTo(answer)); | |
| System.out.println(from(json).get("$.def.length()")); | |
| } | |
| protected String getPathFormated(String key, String text, String languageFormat) { | |
| return String.format("?key=%s&text=%s&lang=%s", key, text, languageFormat); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment