package com.sysu.admin.controller.crop; import com.alibaba.fastjson.JSON; import com.sysu.admin.MarkApplication; import com.sysu.admin.api.base.BaseTest; import com.sysu.admin.support.system.user.User; import junit.framework.TestCase; 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 java.util.Arrays; import java.util.Date; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @RunWith(SpringRunner.class) @SpringBootTest(classes = MarkApplication.class) public class CropLandServiceTest extends BaseTest { @Autowired CropLandService cropLandService; @Test public void testFindOne() { ExecutorService executorService = Executors.newFixedThreadPool(2); CropLand cropLand = cropLandService.findOne(3141964L); executorService.execute(() -> { cropLand.setCreateDate(new Date()); cropLandService.save(cropLand); System.out.println(JSON.toJSONString(cropLand)); }); } @Test public void testFindIdAndNameByExecutor() { List cropLandList = cropLandService.findIdAndNameByExecutor(380402566221008896L); System.out.println(JSON.toJSONString(cropLandList.toArray())); } }