upgrade bootstrap project

This commit is contained in:
Loredana Crusoveanu
2018-05-08 22:04:21 +03:00
parent 88a3f6c0fe
commit 08c0b590b0
6 changed files with 34 additions and 19 deletions
@@ -1,6 +1,5 @@
package org.baeldung;
import static io.restassured.RestAssured.preemptive;
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import static org.apache.commons.lang3.RandomStringUtils.randomNumeric;
import static org.junit.Assert.assertEquals;
@@ -11,7 +10,6 @@ import io.restassured.response.Response;
import java.util.List;
import org.baeldung.persistence.model.Book;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
@@ -24,11 +22,6 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.DEFINED_PORT)
public class SpringBootBootstrapIntegrationTest {
@Before
public void setUp() {
RestAssured.authentication = preemptive().basic("john", "123");
}
private static final String API_ROOT = "http://localhost:8081/api/books";
@Test
@@ -94,6 +87,8 @@ public class SpringBootBootstrapIntegrationTest {
final Book book = createRandomBook();
final String location = createBookAsUri(book);
System.out.println(location);
book.setId(Long.parseLong(location.split("api/books/")[1]));
book.setAuthor("newAuthor");
Response response = RestAssured.given()
@@ -135,6 +130,7 @@ public class SpringBootBootstrapIntegrationTest {
.contentType(MediaType.APPLICATION_JSON_VALUE)
.body(book)
.post(API_ROOT);
System.out.println(response.asString());
return API_ROOT + "/" + response.jsonPath()
.get("id");
}