// Path: src/main/java/com/hantsylabs/restexample/springmvc/domain/Post.java
// @Data
// @Builder
// @NoArgsConstructor
// @AllArgsConstructor
// @Entity
// @Table(name = "posts")
// public class Post implements Serializable {
// 
//     /**
//      *
//      */
//     private static final long serialVersionUID = 1L;
// 
//     public enum Status {
// 
//         DRAFT,
//         PUBLISHED
//     }
// 
//     public Post(String title, String content) {
//         this.title = title;
//         this.content = content;
//     }
//     
//     @Id()
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     @Column(name = "id")
//     private Long id;
// 
//     @Column(name = "title")
//     private String title;
// 
//     @Column(name = "content")
//     @Size(max = 2000)
//     private String content;
// 
//     @Column(name = "status")
//     @Enumerated
//     private Status status = Status.DRAFT;
// 
//     @ManyToOne
//     @JoinColumn(name = "created_by")
//     @CreatedBy
//     private User createdBy;
// 
//     @Column(name = "created_date")
//     @CreatedDate
//     private LocalDateTime createdDate;
// 
//     @ManyToOne
//     @JoinColumn(name = "last_modified_by")
//     @LastModifiedBy
//     private User lastModifiedBy;
// 
//     @Column(name = "last_modified_date")
//     @LastModifiedDate
//     private LocalDateTime lastModifiedDate;
// 
// }
// 
// Path: src/main/java/com/hantsylabs/restexample/springmvc/repository/PostRepository.java
// public interface PostRepository extends JpaRepository<Post, Long>,//
//         JpaSpecificationExecutor<Post>{
// 
// }


import com.hantsylabs.restexample.springmvc.domain.Post;
import com.hantsylabs.restexample.springmvc.repository.PostRepository;
import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.Named;
import org.jbehave.core.annotations.Then;
import org.jbehave.core.annotations.When;
import static org.junit.Assert.assertTrue;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.ResponseEntity;
package com.hantsylabs.restexample.springmvc.test.jbehave.steps;



public class PostSteps {

    PostRepository postRepository;

    TestRestTemplate restTemplate;

    String baseUrl;

    public PostSteps(PostRepository postRepository,
            TestRestTemplate restTemplate,
            String baseUrl) {
        this.postRepository = postRepository;
        this.restTemplate = restTemplate;
        this.baseUrl = baseUrl;
    }

    ResponseEntity<String> reponseEntity;

    @Given("post title is $title and content is $content")
    public void savePost(@Named("title") String title, @Named("content") String content) {
// Path: src/main/java/com/hantsylabs/restexample/springmvc/domain/Post.java
// @Data
// @Builder
// @NoArgsConstructor
// @AllArgsConstructor
// @Entity
// @Table(name = "posts")
// public class Post implements Serializable {
// 
//     /**
//      *
//      */
//     private static final long serialVersionUID = 1L;
// 
//     public enum Status {
// 
//         DRAFT,
//         PUBLISHED
//     }
// 
//     public Post(String title, String content) {
//         this.title = title;
//         this.content = content;
//     }
//     
//     @Id()
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     @Column(name = "id")
//     private Long id;
// 
//     @Column(name = "title")
//     private String title;
// 
//     @Column(name = "content")
//     @Size(max = 2000)
//     private String content;
// 
//     @Column(name = "status")
//     @Enumerated
//     private Status status = Status.DRAFT;
// 
//     @ManyToOne
//     @JoinColumn(name = "created_by")
//     @CreatedBy
//     private User createdBy;
// 
//     @Column(name = "created_date")
//     @CreatedDate
//     private LocalDateTime createdDate;
// 
//     @ManyToOne
//     @JoinColumn(name = "last_modified_by")
//     @LastModifiedBy
//     private User lastModifiedBy;
// 
//     @Column(name = "last_modified_date")
//     @LastModifiedDate
//     private LocalDateTime lastModifiedDate;
// 
// }
// 
// 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/jbehave/steps/PostSteps.java
import com.hantsylabs.restexample.springmvc.domain.Post;
import com.hantsylabs.restexample.springmvc.repository.PostRepository;
import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.Named;
import org.jbehave.core.annotations.Then;
import org.jbehave.core.annotations.When;
import static org.junit.Assert.assertTrue;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.http.ResponseEntity;

package com.hantsylabs.restexample.springmvc.test.jbehave.steps;



public class PostSteps {

    PostRepository postRepository;

    TestRestTemplate restTemplate;

    String baseUrl;

    public PostSteps(PostRepository postRepository,
            TestRestTemplate restTemplate,
            String baseUrl) {
        this.postRepository = postRepository;
        this.restTemplate = restTemplate;
        this.baseUrl = baseUrl;
    }

    ResponseEntity<String> reponseEntity;

    @Given("post title is $title and content is $content")
    public void savePost(@Named("title") String title, @Named("content") String content) {
        postRepository.save(new Post(title, content));