Skip to content

Instantly share code, notes, and snippets.

Last active October 21, 2022 15:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save luuizeduardo/48d88925dd9541913f4c5aace81d620c to your computer and use it in GitHub Desktop.
Improve the object mapping
import com.fasterxml.jackson.databind.JsonNode;
import io.restassured.response.Response;
import org.example.repositories.FileUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static;
public class ApiTest {
private final YourApiService yourApiService;
public ApiTest(YourApiService yourApiService) {
this.yourApiService = yourApiService;
public void testCreateUser() throws IOException {
JsonNode requestBody = FileUtils.readJsonFromFile("user/createUser.json");
Response res = yourApiService.postRequest("/users", requestBody);
assertThat(res.statusCode(), is(equalTo(201)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment