Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
a05209de
Commit
a05209de
authored
May 21, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对blackboard完成测试
parent
9d7a005b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
20 deletions
+13
-20
src/main/java/com/stylefeng/guns/modular/system/controller/BlackboardController.java
+0
-8
src/test/java/com/stylefeng/guns/base/BaseTest.java
+2
-2
src/test/java/com/stylefeng/guns/system/BlackBoardTest.java
+11
-10
No files found.
src/main/java/com/stylefeng/guns/modular/system/controller/BlackboardController.java
View file @
a05209de
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
import
com.stylefeng.guns.common.controller.BaseController
;
import
com.stylefeng.guns.common.persistence.dao.NoticeMapper
;
import
com.stylefeng.guns.common.persistence.dao.UserMapper
;
import
com.stylefeng.guns.modular.system.dao.NoticeDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -23,12 +21,6 @@ import java.util.Map;
public
class
BlackboardController
extends
BaseController
{
@Autowired
UserMapper
userMapper
;
@Autowired
NoticeMapper
noticeMapper
;
@Autowired
NoticeDao
noticeDao
;
/**
...
...
src/test/java/com/stylefeng/guns/base/BaseTest.java
View file @
a05209de
package
com
.
stylefeng
.
guns
.
base
;
import
com.baomidou.mybatisplus.mapper.SqlRunner
;
import
com.stylefeng.guns.GunsApplication
;
import
org.junit.Before
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.annotation.Rollback
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.test.web.servlet.MockMvc
;
...
...
@@ -16,6 +16,7 @@ import org.springframework.web.context.WebApplicationContext;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
=
GunsApplication
.
class
)
@WebAppConfiguration
@Rollback
public
class
BaseTest
{
@Autowired
...
...
@@ -30,6 +31,5 @@ public class BaseTest {
@Before
public
void
initDatabase
(){
SqlRunner
.
db
().
update
(
""
);
}
}
src/test/java/com/stylefeng/guns/system/BlackBoardTest.java
View file @
a05209de
package
com
.
stylefeng
.
guns
.
system
;
import
com.stylefeng.guns.base.BaseTest
;
import
com.stylefeng.guns.modular.system.dao.NoticeDao
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
model
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
import
java.util.List
;
import
java.util.Map
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
* 首页通知展示测试
...
...
@@ -15,14 +18,12 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
*/
public
class
BlackBoardTest
extends
BaseTest
{
@Autowired
NoticeDao
noticeDao
;
@Test
public
void
blackBoardTest
()
{
try
{
super
.
mockMvc
.
perform
(
get
(
"/blackboard"
))
.
andExpect
(
status
().
isOk
())
.
andExpect
(
model
().
attributeExists
(
"noticeList"
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
List
<
Map
<
String
,
Object
>>
notices
=
noticeDao
.
list
(
null
);
assertTrue
(
notices
.
size
()
>
0
);
}
}
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