// Path: src/main/java/com/hantsylabs/restexample/springmvc/model/PostForm.java
// @Data
// @Builder
// @NoArgsConstructor
// @AllArgsConstructor
// public class PostForm implements Serializable {
// 
//     /**
//      *
//      */
//     private static final long serialVersionUID = 1L;
// 
//     @NotNull
//     @NotEmpty
//     private String title;
// 
//     @NotNull
//     @NotEmpty
//     private String content;
// 
// }
// 
// Path: src/main/java/com/hantsylabs/restexample/springmvc/repository/PostRepository.java
// public interface PostRepository extends JpaRepository<Post, Long>,//
//         JpaSpecificationExecutor<Post>{
// 
// }
// 
// Path: src/test/java/com/hantsylabs/restexample/springmvc/test/WebIntegrationTestBase.java
// public class WebIntegrationTestBase extends IntegrationTestBase {
// 
//     @LocalServerPort
//     protected int port;
// 
//     @Before
//     public void setup() {
//         clearData();
//         initData();
//     }
// 
// }


import com.hantsylabs.restexample.springmvc.model.PostForm;
import com.hantsylabs.restexample.springmvc.repository.PostRepository;
import com.hantsylabs.restexample.springmvc.test.WebIntegrationTestBase;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.http.ContentType;
import org.apache.http.HttpStatus;
import org.junit.Before;
import org.junit.Test;
import com.jayway.restassured.response.Response;
import javax.inject.Inject;
import static org.hamcrest.CoreMatchers.containsString;
import static com.jayway.restassured.RestAssured.given;
import lombok.extern.slf4j.Slf4j;
import static org.hamcrest.CoreMatchers.is;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.context.junit4.SpringRunner;
    @Test
    public void testDeletePostNotExisted() {
        String location = "/api/posts/1000";

        given()
                .auth().basic(USER_NAME, PASSWORD)
                .contentType(ContentType.JSON)
                .when()
                .delete(location)
                .then()
                .assertThat()
                .statusCode(HttpStatus.SC_NOT_FOUND);
    }

    @Test
    public void testGetPostNotExisted() {
        String location = "/api/posts/1000";

        given()
                .auth().basic(USER_NAME, PASSWORD)
                .contentType(ContentType.JSON)
                .when()
                .get(location)
                .then()
                .assertThat()
                .statusCode(HttpStatus.SC_NOT_FOUND);
    }

    @Test
    public void testPostFormInValid() {
// Path: src/main/java/com/hantsylabs/restexample/springmvc/model/PostForm.java
// @Data
// @Builder
// @NoArgsConstructor
// @AllArgsConstructor
// public class PostForm implements Serializable {
// 
//     /**
//      *
//      */
//     private static final long serialVersionUID = 1L;
// 
//     @NotNull
//     @NotEmpty
//     private String title;
// 
//     @NotNull
//     @NotEmpty
//     private String content;
// 
// }
// 
// Path: src/main/java/com/hantsylabs/restexample/springmvc/repository/PostRepository.java
// public interface PostRepository extends JpaRepository<Post, Long>,//
//         JpaSpecificationExecutor<Post>{
// 
// }
// 
// Path: src/test/java/com/hantsylabs/restexample/springmvc/test/WebIntegrationTestBase.java
// public class WebIntegrationTestBase extends IntegrationTestBase {
// 
//     @LocalServerPort
//     protected int port;
// 
//     @Before
//     public void setup() {
//         clearData();
//         initData();
//     }
// 
// }


// Path: src/test/java/com/hantsylabs/restexample/springmvc/test/testassured/RestAssuredApplicationTest.java
import com.hantsylabs.restexample.springmvc.model.PostForm;
import com.hantsylabs.restexample.springmvc.repository.PostRepository;
import com.hantsylabs.restexample.springmvc.test.WebIntegrationTestBase;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.http.ContentType;
import org.apache.http.HttpStatus;
import org.junit.Before;
import org.junit.Test;
import com.jayway.restassured.response.Response;
import javax.inject.Inject;
import static org.hamcrest.CoreMatchers.containsString;
import static com.jayway.restassured.RestAssured.given;
import lombok.extern.slf4j.Slf4j;
import static org.hamcrest.CoreMatchers.is;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.test.context.junit4.SpringRunner;

    @Test
    public void testDeletePostNotExisted() {
        String location = "/api/posts/1000";

        given()
                .auth().basic(USER_NAME, PASSWORD)
                .contentType(ContentType.JSON)
                .when()
                .delete(location)
                .then()
                .assertThat()
                .statusCode(HttpStatus.SC_NOT_FOUND);
    }

    @Test
    public void testGetPostNotExisted() {
        String location = "/api/posts/1000";

        given()
                .auth().basic(USER_NAME, PASSWORD)
                .contentType(ContentType.JSON)
                .when()
                .get(location)
                .then()
                .assertThat()
                .statusCode(HttpStatus.SC_NOT_FOUND);
    }

    @Test
    public void testPostFormInValid() {
        PostForm form = new PostForm();