This is the codeAbility Sharing Platform! Learn more about the
codeAbility Sharing Platform
.
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
codeAbility Sharing Platform
Manage
Activity
Members
Labels
Plan
Issues
43
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
development
sharing
codeAbility Sharing Platform
Commits
8d949eb6
Commit
8d949eb6
authored
3 years ago
by
Michael Breu
Browse files
Options
Downloads
Patches
Plain Diff
Fixing Tests
parent
82fc127f
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!55
June Release
,
!52
Resolve "Extend Bookmarklists and implement stored searches"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/at/ac/uibk/gitsearch/web/rest/UserWatchListResourceIT.java
+14
-20
14 additions, 20 deletions
...t/ac/uibk/gitsearch/web/rest/UserWatchListResourceIT.java
with
14 additions
and
20 deletions
src/test/java/at/ac/uibk/gitsearch/web/rest/UserWatchListResourceIT.java
+
14
−
20
View file @
8d949eb6
...
...
@@ -43,7 +43,7 @@ import at.ac.uibk.gitsearch.service.mapper.UserWatchListMapper;
@SpringBootTest
(
classes
=
GitsearchApp
.
class
)
@ExtendWith
(
MockitoExtension
.
class
)
@AutoConfigureMockMvc
@WithMockUser
@WithMockUser
(
authorities
=
AuthoritiesConstants
.
ADMIN
)
public
class
UserWatchListResourceIT
{
private
static
final
String
DEFAULT_NAME
=
"AAAAAAAAAA"
;
...
...
@@ -189,6 +189,7 @@ public class UserWatchListResourceIT {
restUserWatchListMockMvc
.
perform
(
post
(
"/api/user-watch-lists"
)
.
with
(
csrf
().
asHeader
())
.
contentType
(
MediaType
.
APPLICATION_JSON
)
.
content
(
TestUtil
.
convertObjectToJsonBytes
(
userWatchListDTO
)))
.
andExpect
(
status
().
isBadRequest
());
...
...
@@ -396,7 +397,9 @@ public class UserWatchListResourceIT {
* Executes the search, and checks that the default entity is returned.
*/
private
void
defaultUserWatchListShouldBeFound
(
String
filter
)
throws
Exception
{
restUserWatchListMockMvc
.
perform
(
get
(
"/api/user-watch-lists?sort=id,desc&"
+
filter
))
restUserWatchListMockMvc
.
perform
(
get
(
"/api/user-watch-lists?sort=id,desc&"
+
filter
)
.
with
(
csrf
().
asHeader
())
)
.
andExpect
(
status
().
isOk
())
.
andExpect
(
content
().
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
jsonPath
(
"$.[*].id"
).
value
(
hasItem
(
userWatchList
.
getId
().
intValue
())))
...
...
@@ -404,7 +407,9 @@ public class UserWatchListResourceIT {
.
andExpect
(
jsonPath
(
"$.[*].checkFrequency"
).
value
(
hasItem
(
DEFAULT_CHECK_FREQUENCY
.
toString
())));
// Check, that the count call also returns 1
restUserWatchListMockMvc
.
perform
(
get
(
"/api/user-watch-lists/count?sort=id,desc&"
+
filter
))
restUserWatchListMockMvc
.
perform
(
get
(
"/api/user-watch-lists/count?sort=id,desc&"
+
filter
)
.
with
(
csrf
().
asHeader
())
)
.
andExpect
(
status
().
isOk
())
.
andExpect
(
content
().
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
content
().
string
(
"1"
));
...
...
@@ -414,14 +419,18 @@ public class UserWatchListResourceIT {
* Executes the search, and checks that the default entity is not returned.
*/
private
void
defaultUserWatchListShouldNotBeFound
(
String
filter
)
throws
Exception
{
restUserWatchListMockMvc
.
perform
(
get
(
"/api/user-watch-lists?sort=id,desc&"
+
filter
))
restUserWatchListMockMvc
.
perform
(
get
(
"/api/user-watch-lists?sort=id,desc&"
+
filter
)
.
with
(
csrf
().
asHeader
())
.
with
(
csrf
().
asHeader
())
)
.
andExpect
(
status
().
isOk
())
.
andExpect
(
content
().
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
jsonPath
(
"$"
).
isArray
())
.
andExpect
(
jsonPath
(
"$"
).
isEmpty
());
// Check, that the count call also returns 0
restUserWatchListMockMvc
.
perform
(
get
(
"/api/user-watch-lists/count?sort=id,desc&"
+
filter
))
restUserWatchListMockMvc
.
perform
(
get
(
"/api/user-watch-lists/count?sort=id,desc&"
+
filter
)
.
with
(
csrf
().
asHeader
())
)
.
andExpect
(
status
().
isOk
())
.
andExpect
(
content
().
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
content
().
string
(
"0"
));
...
...
@@ -528,19 +537,4 @@ public class UserWatchListResourceIT {
assertThat
(
userWatchListList
).
hasSize
(
databaseSizeBeforeDelete
-
1
);
}
@Test
@Transactional
public
void
searchUserWatchList
()
throws
Exception
{
// Configure the mock search repository
// Initialize the database
userWatchListRepository
.
saveAndFlush
(
userWatchList
);
// Search the userWatchList
restUserWatchListMockMvc
.
perform
(
get
(
"/api/_search/user-watch-lists?query=id:"
+
userWatchList
.
getId
()))
.
andExpect
(
status
().
isOk
())
.
andExpect
(
content
().
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
jsonPath
(
"$.[*].id"
).
value
(
hasItem
(
userWatchList
.
getId
().
intValue
())))
.
andExpect
(
jsonPath
(
"$.[*].name"
).
value
(
hasItem
(
DEFAULT_NAME
)))
.
andExpect
(
jsonPath
(
"$.[*].checkFrequency"
).
value
(
hasItem
(
DEFAULT_CHECK_FREQUENCY
.
toString
())));
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment