RestClient - gorskip/testing-framework GitHub Wiki

Execute Request and get response

RestClient restClient = new RestClientBuilder().build();
Response response = restClient.execute(request);

response.getStatus();
response.getBody();
response.getHeaders();

Response body mapping

RestClient restClient = new RestClientBuilder().build();
Response<Employee> response = restClient.execute(request, Employee.class);
Employee employee = response.getBody();
Employee class:

Fast and easy custom mapping thanks to Lombok and Jackson

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

@Data
@EqualsAndHashCode
public class Employee{

    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Long id;
    private String name;
    private Double saray;
    private List<Task> tasks;
}
⚠️ **GitHub.com Fallback** ⚠️