AssetServiceTest.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package com.izouma.nineth.service;
  2. import com.izouma.nineth.ApplicationTests;
  3. import com.izouma.nineth.domain.*;
  4. import com.izouma.nineth.repo.*;
  5. import org.junit.jupiter.api.Test;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import static org.junit.jupiter.api.Assertions.*;
  8. class AssetServiceTest extends ApplicationTests {
  9. @Autowired
  10. private OrderRepo orderRepo;
  11. @Autowired
  12. private BlindBoxItemRepo blindBoxItemRepo;
  13. @Autowired
  14. private AssetService assetService;
  15. @Autowired
  16. private CollectionRepo collectionRepo;
  17. @Autowired
  18. private UserRepo userRepo;
  19. @Autowired
  20. private CollectionService collectionService;
  21. @Autowired
  22. private AssetMintService assetMintService;
  23. @Autowired
  24. private AssetRepo assetRepo;
  25. @Test
  26. void createAsset() {
  27. BlindBoxItem item = blindBoxItemRepo.findById(1860L).get();
  28. Order order = orderRepo.findById(1922L).get();
  29. }
  30. @Test
  31. void cancelConsignment() {
  32. assetService.cancelConsignment(1209L);
  33. }
  34. @Test
  35. void testCancelConsignment() {
  36. }
  37. @Test
  38. public void testLock() throws InterruptedException {
  39. assetService.testLock("123", "ddd");
  40. }
  41. @Test
  42. public void testCreateAsset() {
  43. Order order = orderRepo.findById(4618L).get();
  44. Collection collection = collectionRepo.findById(order.getCollectionId()).get();
  45. BlindBoxItem blindBoxItem = blindBoxItemRepo.findById(4250L).get();
  46. User user = userRepo.findById(order.getUserId()).get();
  47. assetService.createAsset(blindBoxItem, user, order.getId(), order.getPrice(), "出售", 1);
  48. }
  49. @Test
  50. public void mint() {
  51. Asset asset = assetRepo.findById(4622L).get();
  52. assetMintService.mint(asset, 1L);
  53. }
  54. }