Search in sources :

Example 6 with Product

use of com.rafaelvieira.letmebuy.entities.Product in project letmebuy by rafaelrok.

the class Factory method createProduct.

public static Product createProduct() {
    Product product = new Product(1L, "Phone", "Good Phone", 800.0, "https://img.com/img.png", Instant.parse("2020-10-20T03:00:00Z"));
    product.getCategories().add(new Category(1L, "Electronics"));
    return product;
}
Also used : Category(com.rafaelvieira.letmebuy.entities.Category) Product(com.rafaelvieira.letmebuy.entities.Product)

Aggregations

Product (com.rafaelvieira.letmebuy.entities.Product)6 ProductDTO (com.rafaelvieira.letmebuy.dto.ProductDTO)4 Transactional (org.springframework.transaction.annotation.Transactional)4 Category (com.rafaelvieira.letmebuy.entities.Category)2 ResourceNotFoundException (com.rafaelvieira.letmebuy.services.handlers.ResourceNotFoundException)2 EntityNotFoundException (javax.persistence.EntityNotFoundException)1 Test (org.junit.jupiter.api.Test)1 DataJpaTest (org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest)1