// Path: src/main/java/com/hantsylabs/restexample/springmvc/repository/CommentRepository.java
// public interface CommentRepository extends JpaRepository<Comment, Long> {
// 
//     public List<Comment> findByPost(Post post);
// 
//     public Page<Comment> findByPostId(Long id, Pageable page);
// 
// }
// 
// 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/Fixtures.java
// public class Fixtures {
// 
//     public static User createUser(String username, String password) {
//         return User.builder()
//                 .username(username)
//                 .password(password)
//                 .name("test user")
//                 .email("hantsy@test.com")
//                 .build();
//     }
// 
//     public static UserForm createUserForm(String username, String password) {
//         return UserForm.builder()
//                 .username(username)
//                 .password(password)
//                 .name("test user")
//                 .email("hantsy@test.com")
//                 .build();
//     }
// 
//     public static PasswordForm createPasswordForm(String oldPassword, String newPassword) {
//         return PasswordForm.builder()
//                 .oldPassword(oldPassword)
//                 .newPassword(newPassword)
//                 .build();
//     }
// 
//     public static Post createPost(Long id, String title, String content) {
//         return Post.builder()
//                 .id(id)
//                 .title(title)
//                 .content(content)
//                 .status(Post.Status.DRAFT)
//                 .build();
//     }
// }


import com.hantsylabs.restexample.springmvc.repository.CommentRepository;
import com.hantsylabs.restexample.springmvc.repository.PostRepository;
import com.hantsylabs.restexample.springmvc.test.Fixtures;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.test.context.junit4.SpringRunner;
package com.hantsylabs.restexample.springmvc.test.slice;


/**
 *
 * @author hantsy
 */
@RunWith(SpringRunner.class)
@DataJpaTest()
@Slf4j
public class SimpleDataJpaTest {

    @Inject
    private TestEntityManager em;

    @Inject
// Path: src/main/java/com/hantsylabs/restexample/springmvc/repository/CommentRepository.java
// public interface CommentRepository extends JpaRepository<Comment, Long> {
// 
//     public List<Comment> findByPost(Post post);
// 
//     public Page<Comment> findByPostId(Long id, Pageable page);
// 
// }
// 
// 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/Fixtures.java
// public class Fixtures {
// 
//     public static User createUser(String username, String password) {
//         return User.builder()
//                 .username(username)
//                 .password(password)
//                 .name("test user")
//                 .email("hantsy@test.com")
//                 .build();
//     }
// 
//     public static UserForm createUserForm(String username, String password) {
//         return UserForm.builder()
//                 .username(username)
//                 .password(password)
//                 .name("test user")
//                 .email("hantsy@test.com")
//                 .build();
//     }
// 
//     public static PasswordForm createPasswordForm(String oldPassword, String newPassword) {
//         return PasswordForm.builder()
//                 .oldPassword(oldPassword)
//                 .newPassword(newPassword)
//                 .build();
//     }
// 
//     public static Post createPost(Long id, String title, String content) {
//         return Post.builder()
//                 .id(id)
//                 .title(title)
//                 .content(content)
//                 .status(Post.Status.DRAFT)
//                 .build();
//     }
// }


// Path: src/test/java/com/hantsylabs/restexample/springmvc/test/slice/SimpleDataJpaTest.java
import com.hantsylabs.restexample.springmvc.repository.CommentRepository;
import com.hantsylabs.restexample.springmvc.repository.PostRepository;
import com.hantsylabs.restexample.springmvc.test.Fixtures;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager;
import org.springframework.test.context.junit4.SpringRunner;

package com.hantsylabs.restexample.springmvc.test.slice;


/**
 *
 * @author hantsy
 */
@RunWith(SpringRunner.class)
@DataJpaTest()
@Slf4j
public class SimpleDataJpaTest {

    @Inject
    private TestEntityManager em;

    @Inject
    private PostRepository posts;