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
efb75d46
Commit
efb75d46
authored
3 years ago
by
Michael Breu
Browse files
Options
Downloads
Patches
Plain Diff
Fixing Tests again
parent
8fe9dd2c
2 merge requests
!188
Merging Peer Reviewing et. al to Master
,
!164
211 peer reviewing functionality
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/at/ac/uibk/gitsearch/web/rest/WatchListEntryResourceIT.java
+33
-18
33 additions, 18 deletions
.../ac/uibk/gitsearch/web/rest/WatchListEntryResourceIT.java
with
33 additions
and
18 deletions
src/test/java/at/ac/uibk/gitsearch/web/rest/WatchListEntryResourceIT.java
+
33
−
18
View file @
efb75d46
package
at.ac.uibk.gitsearch.web.rest
;
package
at.ac.uibk.gitsearch.web.rest
;
import
at.ac.uibk.gitsearch.GitsearchApp
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
at.ac.uibk.gitsearch.domain.WatchListEntry
;
import
static
org
.
elasticsearch
.
index
.
query
.
QueryBuilders
.
queryStringQuery
;
import
at.ac.uibk.gitsearch.domain.UserWatchList
;
import
static
org
.
hamcrest
.
Matchers
.
hasItem
;
import
at.ac.uibk.gitsearch.repository.WatchListEntryRepository
;
import
static
org
.
mockito
.
Mockito
.
times
;
import
at.ac.uibk.gitsearch.repository.search.WatchListEntrySearchRepository
;
import
static
org
.
mockito
.
Mockito
.
verify
;
import
at.ac.uibk.gitsearch.service.WatchListEntryService
;
import
static
org
.
mockito
.
Mockito
.
when
;
import
at.ac.uibk.gitsearch.service.dto.WatchListEntryDTO
;
import
static
org
.
springframework
.
security
.
test
.
web
.
servlet
.
request
.
SecurityMockMvcRequestPostProcessors
.
csrf
;
import
at.ac.uibk.gitsearch.service.mapper.WatchListEntryMapper
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
delete
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
post
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
put
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
content
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
jsonPath
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
import
java.util.Collections
;
import
java.util.List
;
import
javax.persistence.EntityManager
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.mockito.Mock
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.mockito.junit.jupiter.MockitoExtension
;
import
org.mockito.junit.jupiter.MockitoExtension
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -23,16 +33,15 @@ import org.springframework.http.MediaType;
...
@@ -23,16 +33,15 @@ import org.springframework.http.MediaType;
import
org.springframework.security.test.context.support.WithMockUser
;
import
org.springframework.security.test.context.support.WithMockUser
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.persistence.EntityManager
;
import
java.util.Collections
;
import
java.util.List
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
at.ac.uibk.gitsearch.GitsearchApp
;
import
static
org
.
elasticsearch
.
index
.
query
.
QueryBuilders
.
queryStringQuery
;
import
at.ac.uibk.gitsearch.domain.UserWatchList
;
import
static
org
.
hamcrest
.
Matchers
.
hasItem
;
import
at.ac.uibk.gitsearch.domain.WatchListEntry
;
import
static
org
.
mockito
.
Mockito
.*;
import
at.ac.uibk.gitsearch.repository.WatchListEntryRepository
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.*;
import
at.ac.uibk.gitsearch.repository.search.WatchListEntrySearchRepository
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.*;
import
at.ac.uibk.gitsearch.service.WatchListEntryService
;
import
at.ac.uibk.gitsearch.service.dto.WatchListEntryDTO
;
import
at.ac.uibk.gitsearch.service.mapper.WatchListEntryMapper
;
/**
/**
* Integration tests for the {@link WatchListEntryResource} REST controller.
* Integration tests for the {@link WatchListEntryResource} REST controller.
...
@@ -131,6 +140,7 @@ public class WatchListEntryResourceIT {
...
@@ -131,6 +140,7 @@ public class WatchListEntryResourceIT {
// Create the WatchListEntry
// Create the WatchListEntry
WatchListEntryDTO
watchListEntryDTO
=
watchListEntryMapper
.
toDto
(
watchListEntry
);
WatchListEntryDTO
watchListEntryDTO
=
watchListEntryMapper
.
toDto
(
watchListEntry
);
restWatchListEntryMockMvc
.
perform
(
post
(
"/api/watch-list-entries"
)
restWatchListEntryMockMvc
.
perform
(
post
(
"/api/watch-list-entries"
)
.
with
(
csrf
().
asHeader
())
.
contentType
(
MediaType
.
APPLICATION_JSON
)
.
contentType
(
MediaType
.
APPLICATION_JSON
)
.
content
(
TestUtil
.
convertObjectToJsonBytes
(
watchListEntryDTO
)))
.
content
(
TestUtil
.
convertObjectToJsonBytes
(
watchListEntryDTO
)))
.
andExpect
(
status
().
isCreated
());
.
andExpect
(
status
().
isCreated
());
...
@@ -157,6 +167,7 @@ public class WatchListEntryResourceIT {
...
@@ -157,6 +167,7 @@ public class WatchListEntryResourceIT {
// An entity with an existing ID cannot be created, so this API call must fail
// An entity with an existing ID cannot be created, so this API call must fail
restWatchListEntryMockMvc
.
perform
(
post
(
"/api/watch-list-entries"
)
restWatchListEntryMockMvc
.
perform
(
post
(
"/api/watch-list-entries"
)
.
with
(
csrf
().
asHeader
())
.
contentType
(
MediaType
.
APPLICATION_JSON
)
.
contentType
(
MediaType
.
APPLICATION_JSON
)
.
content
(
TestUtil
.
convertObjectToJsonBytes
(
watchListEntryDTO
)))
.
content
(
TestUtil
.
convertObjectToJsonBytes
(
watchListEntryDTO
)))
.
andExpect
(
status
().
isBadRequest
());
.
andExpect
(
status
().
isBadRequest
());
...
@@ -182,6 +193,7 @@ public class WatchListEntryResourceIT {
...
@@ -182,6 +193,7 @@ public class WatchListEntryResourceIT {
restWatchListEntryMockMvc
.
perform
(
post
(
"/api/watch-list-entries"
)
restWatchListEntryMockMvc
.
perform
(
post
(
"/api/watch-list-entries"
)
.
with
(
csrf
().
asHeader
())
.
contentType
(
MediaType
.
APPLICATION_JSON
)
.
contentType
(
MediaType
.
APPLICATION_JSON
)
.
content
(
TestUtil
.
convertObjectToJsonBytes
(
watchListEntryDTO
)))
.
content
(
TestUtil
.
convertObjectToJsonBytes
(
watchListEntryDTO
)))
.
andExpect
(
status
().
isBadRequest
());
.
andExpect
(
status
().
isBadRequest
());
...
@@ -245,6 +257,7 @@ public class WatchListEntryResourceIT {
...
@@ -245,6 +257,7 @@ public class WatchListEntryResourceIT {
WatchListEntryDTO
watchListEntryDTO
=
watchListEntryMapper
.
toDto
(
updatedWatchListEntry
);
WatchListEntryDTO
watchListEntryDTO
=
watchListEntryMapper
.
toDto
(
updatedWatchListEntry
);
restWatchListEntryMockMvc
.
perform
(
put
(
"/api/watch-list-entries"
)
restWatchListEntryMockMvc
.
perform
(
put
(
"/api/watch-list-entries"
)
.
with
(
csrf
().
asHeader
())
.
contentType
(
MediaType
.
APPLICATION_JSON
)
.
contentType
(
MediaType
.
APPLICATION_JSON
)
.
content
(
TestUtil
.
convertObjectToJsonBytes
(
watchListEntryDTO
)))
.
content
(
TestUtil
.
convertObjectToJsonBytes
(
watchListEntryDTO
)))
.
andExpect
(
status
().
isOk
());
.
andExpect
(
status
().
isOk
());
...
@@ -270,6 +283,7 @@ public class WatchListEntryResourceIT {
...
@@ -270,6 +283,7 @@ public class WatchListEntryResourceIT {
// If the entity doesn't have an ID, it will throw BadRequestAlertException
// If the entity doesn't have an ID, it will throw BadRequestAlertException
restWatchListEntryMockMvc
.
perform
(
put
(
"/api/watch-list-entries"
)
restWatchListEntryMockMvc
.
perform
(
put
(
"/api/watch-list-entries"
)
.
with
(
csrf
().
asHeader
())
.
contentType
(
MediaType
.
APPLICATION_JSON
)
.
contentType
(
MediaType
.
APPLICATION_JSON
)
.
content
(
TestUtil
.
convertObjectToJsonBytes
(
watchListEntryDTO
)))
.
content
(
TestUtil
.
convertObjectToJsonBytes
(
watchListEntryDTO
)))
.
andExpect
(
status
().
isBadRequest
());
.
andExpect
(
status
().
isBadRequest
());
...
@@ -292,6 +306,7 @@ public class WatchListEntryResourceIT {
...
@@ -292,6 +306,7 @@ public class WatchListEntryResourceIT {
// Delete the watchListEntry
// Delete the watchListEntry
restWatchListEntryMockMvc
.
perform
(
delete
(
"/api/watch-list-entries/{id}"
,
watchListEntry
.
getId
())
restWatchListEntryMockMvc
.
perform
(
delete
(
"/api/watch-list-entries/{id}"
,
watchListEntry
.
getId
())
.
with
(
csrf
().
asHeader
())
.
accept
(
MediaType
.
APPLICATION_JSON
))
.
accept
(
MediaType
.
APPLICATION_JSON
))
.
andExpect
(
status
().
isNoContent
());
.
andExpect
(
status
().
isNoContent
());
...
...
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