Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
49262110
Commit
49262110
authored
Sep 03, 2018
by
Junling Bu
Browse files
chore[litemall-db]: 一个测试mapper返回值的测试用例。
通常mapper的crud的int返回值是数据库所影响的数据的条目数量。
parent
92e07a55
Changes
1
Hide whitespace changes
Inline
Side-by-side
litemall-db/src/test/java/org/linlinjava/litemall/db/MapperReturnTest.java
0 → 100644
View file @
49262110
package
org.linlinjava.litemall.db
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.linlinjava.litemall.db.dao.LitemallSystemMapper
;
import
org.linlinjava.litemall.db.domain.LitemallSystem
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
@WebAppConfiguration
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
public
class
MapperReturnTest
{
@Autowired
private
LitemallSystemMapper
systemMapper
;
@Test
public
void
test
()
{
LitemallSystem
system
=
new
LitemallSystem
();
system
.
setKeyName
(
"test-system-key"
);
system
.
setKeyValue
(
"test-system-value"
);
int
updates
=
systemMapper
.
insertSelective
(
system
);
Assert
.
assertEquals
(
updates
,
1
);
updates
=
systemMapper
.
deleteByPrimaryKey
(
system
.
getId
());
Assert
.
assertEquals
(
updates
,
1
);
updates
=
systemMapper
.
updateByPrimaryKey
(
system
);
Assert
.
assertEquals
(
updates
,
0
);
}
}
Write
Preview
Supports
Markdown
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