Skip to content

Instantly share code, notes, and snippets.

@ToshiDono
Created July 26, 2018 05:40
Show Gist options
  • Select an option

  • Save ToshiDono/d5bdf67054e4e954948208e28560fdbe to your computer and use it in GitHub Desktop.

Select an option

Save ToshiDono/d5bdf67054e4e954948208e28560fdbe to your computer and use it in GitHub Desktop.
@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