Search in sources :

Example 6 with Category

use of com.rafaelvieira.letmebuy.entities.Category 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

Category (com.rafaelvieira.letmebuy.entities.Category)6 CategoryDTO (com.rafaelvieira.letmebuy.dto.CategoryDTO)4 Transactional (org.springframework.transaction.annotation.Transactional)4 Product (com.rafaelvieira.letmebuy.entities.Product)2 ResourceNotFoundException (com.rafaelvieira.letmebuy.services.handlers.ResourceNotFoundException)2 ProductDTO (com.rafaelvieira.letmebuy.dto.ProductDTO)1 EntityNotFoundException (javax.persistence.EntityNotFoundException)1