package com.prolog.cs.biz.outbound.service.impl;

import com.alibaba.fastjson.JSON;
import com.prolog.cs.biz.outbound.Application;
import com.prolog.cs.biz.outbound.dao.WaveBillMapper;
import com.prolog.cs.biz.outbound.model.entity.WaveBillDO;
import com.prolog.cs.biz.outbound.resource.ItemClient;
import com.prolog.cs.biz.outbound.resource.WarehouseResource;
import com.prolog.framework.core.restriction.Criteria;
import org.assertj.core.util.Arrays;
import org.junit.Before;
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 org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;


/**
 * 基础测试类
 *
 * @author stylefeng
 * @Date 2017/5/21 16:10
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@WebAppConfiguration
//@Transactional //打开的话测试之后数据可自动回滚
public class ResourceClientJunit {

    @Autowired
    WebApplicationContext webApplicationContext;
    @Autowired
    PickTaskAppServiceImpl PickTaskAppServiceImpl;

    protected MockMvc mockMvc;

    @Autowired
    private WarehouseResource warehouseResource;

    @Autowired
    private WaveBillMapper billMapper;

    @Autowired
    private ItemClient itemClient;

    @Before
    public void setupMockMvc(){
        mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
    }

    @Before
    public void initDatabase(){
    }
    
    @Test
    public void outerCheckUnCheck() throws Exception {
        Set<String> itemIds=new HashSet<>();
        itemIds.add("0021255005");
        itemIds.add("0021256301");
        System.out.println(JSON.toJSONString(itemClient.getListByIds(itemIds)));
    }

    public static void main(String[] args) {
        List list= Arrays.asList(new Integer[]{1,2,3,4});
        list.forEach(x -> {
            if((Integer) x==2){
                return;
            }
            System.out.println(x);
        });
    }
}
