CropLandServiceTest.java 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package com.sysu.admin.controller.crop;
  2. import com.alibaba.fastjson.JSON;
  3. import com.sysu.admin.MarkApplication;
  4. import com.sysu.admin.api.base.BaseTest;
  5. import com.sysu.admin.support.system.user.User;
  6. import junit.framework.TestCase;
  7. import org.junit.Test;
  8. import org.junit.runner.RunWith;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.boot.test.context.SpringBootTest;
  11. import org.springframework.test.context.junit4.SpringRunner;
  12. import java.util.Arrays;
  13. import java.util.Date;
  14. import java.util.List;
  15. import java.util.concurrent.ExecutorService;
  16. import java.util.concurrent.Executors;
  17. @RunWith(SpringRunner.class)
  18. @SpringBootTest(classes = MarkApplication.class)
  19. public class CropLandServiceTest extends BaseTest {
  20. @Autowired
  21. CropLandService cropLandService;
  22. @Test
  23. public void testFindOne() {
  24. ExecutorService executorService = Executors.newFixedThreadPool(2);
  25. CropLand cropLand = cropLandService.findOne(3141964L);
  26. executorService.execute(() -> {
  27. cropLand.setCreateDate(new Date());
  28. cropLandService.save(cropLand);
  29. System.out.println(JSON.toJSONString(cropLand));
  30. });
  31. }
  32. @Test
  33. public void testFindIdAndNameByExecutor() {
  34. List<CropLand> cropLandList = cropLandService.findIdAndNameByExecutor(380402566221008896L);
  35. System.out.println(JSON.toJSONString(cropLandList.toArray()));
  36. }
  37. }