package com.ruoyi.api;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.ruoyi.api.downstream.YzResult;
import com.ruoyi.api.service.ICategoryService;
import com.ruoyi.api.service.IProductService;
import org.junit.Test;
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 javax.annotation.Resource;

@SpringBootTest
@RunWith(SpringRunner.class)
public class ProductsTests {
    @Resource
    private IProductService productService;
    @Autowired
    private ICategoryService categoryService;

    @Test
    public void testPushProduct() throws JsonProcessingException {
        YzResult yzResult = productService.pushProduct();
        System.out.println(yzResult);
    }

    @Test
    public void testUpdateCloudProduct() throws JsonProcessingException {
        YzResult yzResult = productService.updateCloudProduct();
        System.out.println(yzResult);
    }

    @Test
    public void testUpdateCloudSku() throws JsonProcessingException {
        YzResult yzResult = productService.updateCloudSku();
        System.out.println(yzResult);
    }

    @Test
    public void testDisplayProductByIds() throws JsonProcessingException {
        YzResult yzResult = productService.displayProductByIds();
        System.out.println(yzResult);
    }

    @Test
    public void testFindProduct() throws JsonProcessingException {
        YzResult yzResult = productService.findProduct();
        System.out.println(yzResult);
    }

    @Test
    public void testDeleteProduct() throws JsonProcessingException {
        YzResult yzResult = productService.deleteProduct();
        System.out.println(yzResult);
    }

    @Test
    public void testGetProductsList() throws JsonProcessingException{
        YzResult yzResult = productService.getProductsList();
        System.out.println(yzResult);
    }

    @Test
    public void testGetCategory() throws JsonProcessingException{
        YzResult yzResult = categoryService.getCategoryTree();
        System.out.println(yzResult);
    }
}
