Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class QueryEndpoint {
- @BeforeClass
- public static void setup() {
- String username = "username111";
- String password = "password222";
- StringBuilder authorization = new StringBuilder();
- authorization.append(username).append(":").append(password);
- String authHeader = "Basic " + Base64.getEncoder().encodeToString(authorization.toString().getBytes());
- }
- package com.example.tests;
- import com.jayway.restassured.authentication.PreemptiveBasicAuthScheme;
- import com.example.misc.QueryEndpoint;
- public class ApiTest extends QueryEndpoint {
- @Test
- public void verifyTopLevelURL() {
- given()
- .header("Authorization", authScheme) // <--HERE
- .contentType("application/json")
- .when().get("/22222222").then()
- .body("fruit",equalTo("22222222"))
- .body("fruit.apple",equalTo(37))
- .body("fruit.banana",equalTo("111"))
- .statusCode(200);
- }
- }
Add Comment
Please, Sign In to add comment