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
Commits
086b805b
There was an error fetching the commit references. Please try again later.
Commit
086b805b
authored
2 years ago
by
evilimkova
Browse files
Options
Downloads
Patches
Plain Diff
Delete old tests
parent
8c5dfb12
No related branches found
No related tags found
4 merge requests
!31
M2
,
!29
M2 exercise
,
!27
Draft: M2 user
,
!19
M2 certificate
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
application/module-certificate/src/test/java/org/fuseri/modulecertificate/ModuleCertificateCertificateControllerTests.java
+0
-66
0 additions, 66 deletions
...tificate/ModuleCertificateCertificateControllerTests.java
with
0 additions
and
66 deletions
application/module-certificate/src/test/java/org/fuseri/modulecertificate/ModuleCertificateCertificateControllerTests.java
deleted
100644 → 0
+
0
−
66
View file @
8c5dfb12
package
org.fuseri.modulecertificate
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
org.fuseri.model.dto.certificate.CertificateCreateDto
;
import
org.fuseri.model.dto.certificate.CertificateDto
;
import
org.fuseri.model.dto.course.CourseDto
;
import
org.fuseri.model.dto.course.LanguageTypeDto
;
import
org.fuseri.model.dto.course.ProficiencyLevelDto
;
import
org.fuseri.model.dto.user.AddressDto
;
import
org.fuseri.model.dto.user.UserDto
;
import
org.fuseri.modulecertificate.service.CertificateController
;
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.http.MediaType
;
import
org.springframework.test.web.servlet.MockMvc
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
static
org
.
hamcrest
.
Matchers
.*;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.*;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
@SpringBootTest
@AutoConfigureMockMvc
class
ModuleCertificateCertificateControllerTests
{
@Autowired
private
MockMvc
mockMvc
;
@Autowired
ObjectMapper
objectMapper
;
@Test
void
generateCertificate
()
throws
Exception
{
CertificateDto
expectedResponse
=
new
CertificateDto
();
String
response
=
mockMvc
.
perform
(
post
(
"/certificates/generate"
)
.
content
(
asJsonString
(
new
CertificateCreateDto
(
new
UserDto
(
"novakovat"
,
"novakova@gamil.com"
,
"Tereza"
,
"Nováková"
,
new
AddressDto
()),
new
CourseDto
(
"AJ1"
,
10
,
LanguageTypeDto
.
ENGLISH
,
ProficiencyLevelDto
.
A1
))))
.
contentType
(
MediaType
.
APPLICATION_JSON
))
.
andExpect
(
status
().
isOk
())
.
andReturn
().
getResponse
().
getContentAsString
();
CertificateController
certificateController
=
objectMapper
.
readValue
(
response
,
CertificateController
.
class
);
assertThat
(
"response"
,
certificateController
.
find
(
0L
),
is
(
instanceOf
(
expectedResponse
.
getClass
())));
}
@Test
void
deleteCertificate
()
throws
Exception
{
String
response
=
mockMvc
.
perform
(
delete
(
"/certificates/delete"
)
.
param
(
"id"
,
"1"
))
.
andExpect
(
status
().
isOk
())
.
andReturn
().
getResponse
().
getContentAsString
();
}
public
static
String
asJsonString
(
final
Object
obj
)
{
try
{
return
new
ObjectMapper
().
writeValueAsString
(
obj
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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