Commit 731fbd04 authored by yanzg's avatar yanzg

表结构修改

parent e3fd5a3f
package helper;
import com.yanzuoguang.util.helper.CheckerHelper;
import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.vo.DataDaoKey;
import com.yanzuoguang.util.vo.DataDaoVo;
import org.junit.Assert;
import org.junit.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class DataDaoVoTest {
class Temp {
long id;
String productId;
String productType;
int value;
int removeFlag;
public Temp() {
}
public Temp(long id, String productId, String productType, int value, int removeFlag) {
this.id = id;
this.productId = productId;
this.productType = productType;
this.value = value;
this.removeFlag = removeFlag;
}
}
@Test
public void testEn() {
int id = 1;
List<Temp> his = Arrays.asList(
new Temp(id++,"产品1","类型1",1,0),
new Temp(id++,"产品1","类型1",2,1),
new Temp(id++,"产品1","类型1",3,1),
new Temp(id++,"产品1","类型1",4,1),
new Temp(id++,"产品2","类型2",4,0),
new Temp(id++,"产品3","类型3",4,0)
);
List<Temp> now = Arrays.asList(
new Temp(id++,"产品1","类型1",9,0),
new Temp(id++,"产品2","类型2",43,0),
new Temp(id++,"产品4","类型4",95,0)
);
DataDaoVo<Temp> init = DataDaoVo.init(his, now, new DataDaoKey<Temp>() {
@Override
public String getKey(Temp from) {
return StringHelper.getId(from.productId, from.productType);
}
});
Assert.assertEquals(init.getCreates().size(),1);
Assert.assertEquals(init.getUpdates().size(),2);
Assert.assertEquals(init.getRemoves().size(),4);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment