// Path: research-graphql-product-service/src/main/java/me/roybailey/springboot/configuration/JpaRepositoryConfiguration.java
// @Configuration
// @EnableAutoConfiguration
// @EnableTransactionManagement
// @EntityScan(basePackages = {"me.roybailey.springboot.domain"})
// @EnableJpaRepositories(basePackages = {"me.roybailey.springboot.repository"})
// public class JpaRepositoryConfiguration {
// }
// 
// Path: research-graphql-product-service/src/main/java/me/roybailey/springboot/domain/Category.java
// @Data
// @Builder
// @Entity
// @NoArgsConstructor
// @AllArgsConstructor
// public class Category {
// 
//     @Id
//     @GeneratedValue
//     private String id;
// 
//     @Column(unique=true)
//     private String name;
// 
// }
// 
// Path: research-graphql-product-service/src/main/java/me/roybailey/springboot/domain/Product.java
// @Data
// @Builder
// @Entity
// @NoArgsConstructor
// @AllArgsConstructor
// public class Product {
// 
//     @Id
//     @GeneratedValue
//     private String id;
// 
//     private String name;
// 
//     private String brand;
// 
//     private String description;
// 
//     private BigDecimal price;
// 
//     @ManyToMany(fetch = FetchType.EAGER)
//     @JoinTable(
//             name="PRODUCT_CATEGORY",
//             joinColumns=@JoinColumn(name="PRODUCT_ID", referencedColumnName="ID"),
//             inverseJoinColumns=@JoinColumn(name="CATEGORY_ID", referencedColumnName="ID"))
//     private List<Category> categories;
// }


import com.google.common.collect.ImmutableList;
import lombok.extern.slf4j.Slf4j;
import me.roybailey.springboot.configuration.JpaRepositoryConfiguration;
import me.roybailey.springboot.domain.Category;
import me.roybailey.springboot.domain.Product;
import org.assertj.core.api.JUnitBDDSoftAssertions;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import static org.assertj.core.api.Assertions.assertThat;
package me.roybailey.springboot.repository;





@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = JpaRepositoryConfiguration.class)
public class ProductRepositoryTest {

    @Autowired
    private CategoryRepository categoryRepository;

    @Autowired
    private ProductRepository productRepository;

    @Rule
    public TestName name= new TestName();

    @Rule
    public final JUnitBDDSoftAssertions softly = new JUnitBDDSoftAssertions();


    private List<Category> loadAllCategories() {
        return StreamSupport.stream(categoryRepository.findAll().spliterator(), false)
                .collect(Collectors.toList());
    }

    private List<Product> loadAllProducts() {
        return StreamSupport.stream(productRepository.findAll().spliterator(), false)
                .collect(Collectors.toList());
    }

// Path: research-graphql-product-service/src/main/java/me/roybailey/springboot/configuration/JpaRepositoryConfiguration.java
// @Configuration
// @EnableAutoConfiguration
// @EnableTransactionManagement
// @EntityScan(basePackages = {"me.roybailey.springboot.domain"})
// @EnableJpaRepositories(basePackages = {"me.roybailey.springboot.repository"})
// public class JpaRepositoryConfiguration {
// }
// 
// Path: research-graphql-product-service/src/main/java/me/roybailey/springboot/domain/Category.java
// @Data
// @Builder
// @Entity
// @NoArgsConstructor
// @AllArgsConstructor
// public class Category {
// 
//     @Id
//     @GeneratedValue
//     private String id;
// 
//     @Column(unique=true)
//     private String name;
// 
// }
// 
// Path: research-graphql-product-service/src/main/java/me/roybailey/springboot/domain/Product.java
// @Data
// @Builder
// @Entity
// @NoArgsConstructor
// @AllArgsConstructor
// public class Product {
// 
//     @Id
//     @GeneratedValue
//     private String id;
// 
//     private String name;
// 
//     private String brand;
// 
//     private String description;
// 
//     private BigDecimal price;
// 
//     @ManyToMany(fetch = FetchType.EAGER)
//     @JoinTable(
//             name="PRODUCT_CATEGORY",
//             joinColumns=@JoinColumn(name="PRODUCT_ID", referencedColumnName="ID"),
//             inverseJoinColumns=@JoinColumn(name="CATEGORY_ID", referencedColumnName="ID"))
//     private List<Category> categories;
// }


// Path: research-graphql-product-service/src/test/java/me/roybailey/springboot/repository/ProductRepositoryTest.java
import com.google.common.collect.ImmutableList;
import lombok.extern.slf4j.Slf4j;
import me.roybailey.springboot.configuration.JpaRepositoryConfiguration;
import me.roybailey.springboot.domain.Category;
import me.roybailey.springboot.domain.Product;
import org.assertj.core.api.JUnitBDDSoftAssertions;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import static org.assertj.core.api.Assertions.assertThat;

package me.roybailey.springboot.repository;





@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = JpaRepositoryConfiguration.class)
public class ProductRepositoryTest {

    @Autowired
    private CategoryRepository categoryRepository;

    @Autowired
    private ProductRepository productRepository;

    @Rule
    public TestName name= new TestName();

    @Rule
    public final JUnitBDDSoftAssertions softly = new JUnitBDDSoftAssertions();


    private List<Category> loadAllCategories() {
        return StreamSupport.stream(categoryRepository.findAll().spliterator(), false)
                .collect(Collectors.toList());
    }

    private List<Product> loadAllProducts() {
        return StreamSupport.stream(productRepository.findAll().spliterator(), false)
                .collect(Collectors.toList());
    }

    @Test