Skip to content

Instantly share code, notes, and snippets.

@brunokrebs
Created March 10, 2016 12:05
Show Gist options
  • Save brunokrebs/93b1e492ff585d064591 to your computer and use it in GitHub Desktop.
Save brunokrebs/93b1e492ff585d064591 to your computer and use it in GitHub Desktop.
package br.com.brunokrebs;
import br.com.brunokrebs.model.User;
import com.jayway.restassured.http.ContentType;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.springframework.http.HttpStatus;
import static com.jayway.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class UserRestIT {
private static final String USER_ENDPOINT = "/users/";
@Test
public void test1CreateUser() {
User user = new User("Bruno Krebs", "brunokrebs@spam4.me", "bestpasswordever");
given().contentType(ContentType.JSON).body(user)
.when().post(USER_ENDPOINT).then()
.assertThat().statusCode(equalTo(HttpStatus.OK.value()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment