Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sprachschulsystem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Pokorný
Sprachschulsystem
Merge requests
!12
An error occurred while fetching the assigned milestone of the selected merge_request.
Mail module
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Mail module
Mail-Module
into
main
Overview
0
Commits
12
Pipelines
3
Changes
1
Merged
Martin Gargalovič
requested to merge
Mail-Module
into
main
2 years ago
Overview
0
Commits
12
Pipelines
3
Changes
1
Expand
0
0
Merge request reports
Viewing commit
d24ac9fa
Prev
Next
Show latest version
1 file
+
20
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
d24ac9fa
Add sendMail
· d24ac9fa
Dominika Zemanovičová
authored
2 years ago
application/module-mail/src/test/java/org/fuseri/modulemail/service/MailControllerTest.java
+
20
−
2
Options
package
org.fuseri.modulemail.service
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.fuseri.model.dto.mail.MailDto
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.mock.mockito.MockBean
;
import
org.springframework.http.MediaType
;
import
org.springframework.test.web.servlet.MockMvc
;
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
.*;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
@SpringBootTest
@@ -29,4 +33,18 @@ class MailControllerTest {
.
andExpect
(
status
().
isOk
());
}
@Test
void
sendMail
()
throws
Exception
{
// TODO use mocks
mockMvc
.
perform
(
post
(
"/mail"
)
.
content
(
asJsonString
(
new
MailDto
(
"12marting02@gmail.com"
,
"Hello"
)))
.
contentType
(
MediaType
.
APPLICATION_JSON
))
.
andExpect
(
status
().
isOk
());
}
private
static
String
asJsonString
(
final
Object
obj
)
throws
JsonProcessingException
{
return
new
ObjectMapper
().
writeValueAsString
(
obj
);
}
}
\ No newline at end of file
Loading