创建商品功能完善
This commit is contained in:
34
mall-admin/src/test/com/macro/mall/PmsDaoTests.java
Normal file
34
mall-admin/src/test/com/macro/mall/PmsDaoTests.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.macro.mall;
|
||||
|
||||
|
||||
import com.macro.mall.dao.PmsMemberPriceDao;
|
||||
import com.macro.mall.model.PmsMemberPrice;
|
||||
import org.junit.Assert;
|
||||
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.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class PmsDaoTests {
|
||||
@Autowired
|
||||
private PmsMemberPriceDao memberPriceDao;
|
||||
@Test
|
||||
public void testInsertBatch(){
|
||||
List<PmsMemberPrice> list = new ArrayList<>();
|
||||
for(int i=0;i<5;i++){
|
||||
PmsMemberPrice memberPrice = new PmsMemberPrice();
|
||||
memberPrice.setProductId(1L);
|
||||
memberPrice.setMemberLevelId((long) (i+1));
|
||||
memberPrice.setMemberPrice(new BigDecimal("22"));
|
||||
list.add(memberPrice);
|
||||
}
|
||||
int count = memberPriceDao.insertList(list);
|
||||
Assert.assertEquals(5,count);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user