Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
731fbd04
Commit
731fbd04
authored
May 05, 2023
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表结构修改
parent
e3fd5a3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
DataDaoVoTest.java
yzg-util-base/src/test/java/helper/DataDaoVoTest.java
+65
-0
No files found.
yzg-util-base/src/test/java/helper/DataDaoVoTest.java
0 → 100644
View file @
731fbd04
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
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment