SpecControllerTest.java 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package com.izouma.dingdong.contorller;
  2. import com.izouma.dingdong.domain.OrderGoodsSpec;
  3. import com.izouma.dingdong.domain.merchant.GoodsSpecification;
  4. import com.izouma.dingdong.repo.OrderGoodsSpecRepo;
  5. import com.izouma.dingdong.repo.merchant.GoodsSpecificationRepo;
  6. import com.izouma.dingdong.service.OrderGoodsSpecService;
  7. import com.izouma.dingdong.web.merchant.GoodsSpecificationController;
  8. import org.junit.Test;
  9. import org.junit.runner.RunWith;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.boot.test.context.SpringBootTest;
  12. import org.springframework.test.context.junit4.SpringRunner;
  13. import java.math.BigDecimal;
  14. @RunWith(SpringRunner.class)
  15. @SpringBootTest
  16. public class SpecControllerTest {
  17. @Autowired
  18. private GoodsSpecificationController controller;
  19. @Autowired
  20. private GoodsSpecificationRepo repo;
  21. @Autowired
  22. private OrderGoodsSpecService orderGoodsSpecService;
  23. // @Autowired
  24. // private OrderGoodsSpecRepo orderGoodsSpecRepo;
  25. @Test
  26. public void test(){
  27. GoodsSpecification build = GoodsSpecification.builder()
  28. .goodsId(698L)
  29. .name("全糖")
  30. .parent(703L)
  31. //.amount(BigDecimal.valueOf(12))
  32. //.multiple(false)
  33. .build();
  34. System.out.println(controller.save(build));
  35. }
  36. @Test
  37. public void testMy(){
  38. System.out.println(repo.findAllByGoodsIdAndParentIsNull(698L));
  39. }
  40. @Test
  41. public void testOrder(){
  42. //System.out.println(orderGoodsSpecRepo.findById(716L).orElse(null));
  43. System.out.println(orderGoodsSpecService.add(698L, "701,705", 1));
  44. }
  45. }