Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Wendys Racing Horses
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
tu-wien
Wendys Racing Horses
Commits
c10bbb59
Commit
c10bbb59
authored
Mar 28, 2020
by
Ivaylo Ivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TS13: Remove duplicate tests and fix wording
parent
19b5e71f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
53 deletions
+1
-53
backend/src/test/java/at/ac/tuwien/sepm/assignment/individual/integration/HorseEndpointTest.java
.../assignment/individual/integration/HorseEndpointTest.java
+0
-35
backend/src/test/java/at/ac/tuwien/sepm/assignment/individual/integration/OwnerEndpointTest.java
.../assignment/individual/integration/OwnerEndpointTest.java
+1
-18
No files found.
backend/src/test/java/at/ac/tuwien/sepm/assignment/individual/integration/HorseEndpointTest.java
View file @
c10bbb59
...
...
@@ -146,41 +146,6 @@ public class HorseEndpointTest {
assertEquals
(
newHorse
.
getOwner
(),
response
.
getBody
().
getOwner
());
}
@Test
@DisplayName
(
"Updating a horse with the correct parameters will return 200 and the new HorseDto"
)
public
void
updatingNewHorse_correctParameters_shouldReturnStatus200AndHorse
()
{
HorseDto
newHorse
=
new
HorseDto
(
"Zephyr"
,
"Nice horse"
,
(
short
)
4
,
Date
.
valueOf
(
"2020-01-01"
),
ERace
.
APPALOOSA
,
"files/test.png"
,
null
);
// Create a new horse
HttpEntity
<
HorseDto
>
request
=
new
HttpEntity
<>(
newHorse
);
ResponseEntity
<
HorseDto
>
response
=
REST_TEMPLATE
.
exchange
(
BASE_URL
+
port
+
HORSE_URL
,
HttpMethod
.
POST
,
request
,
HorseDto
.
class
);
// Update the horse
newHorse
.
setId
(
response
.
getBody
().
getId
());
newHorse
.
setName
(
"Katrina"
);
newHorse
.
setDescription
(
"Fast horse"
);
newHorse
.
setScore
((
short
)
3
);
newHorse
.
setBirthday
(
Date
.
valueOf
(
"2005-01-01"
));
newHorse
.
setRace
(
ERace
.
MORGAN
);
newHorse
.
setImagePath
(
"files/katrina.png"
);
newHorse
.
setOwner
(
null
);
request
=
new
HttpEntity
<>(
newHorse
);
response
=
REST_TEMPLATE
.
exchange
(
BASE_URL
+
port
+
HORSE_URL
+
'/'
+
newHorse
.
getId
(),
HttpMethod
.
PUT
,
request
,
HorseDto
.
class
);
// Compare everything except timestamps
assertEquals
(
response
.
getStatusCode
(),
HttpStatus
.
OK
);
assertEquals
(
newHorse
.
getId
(),
response
.
getBody
().
getId
());
assertEquals
(
newHorse
.
getName
(),
response
.
getBody
().
getName
());
assertEquals
(
newHorse
.
getDescription
(),
response
.
getBody
().
getDescription
());
assertEquals
(
newHorse
.
getScore
(),
response
.
getBody
().
getScore
());
assertEquals
(
newHorse
.
getBirthday
().
toString
(),
response
.
getBody
().
getBirthday
().
toString
());
assertEquals
(
newHorse
.
getImagePath
(),
response
.
getBody
().
getImagePath
());
assertEquals
(
newHorse
.
getOwner
(),
response
.
getBody
().
getOwner
());
}
@Test
@DisplayName
(
"Uploading an image in the correct format will return HTTP 201"
)
public
void
addingNewImage_correctFormat_shouldReturnStatus201
()
{
...
...
backend/src/test/java/at/ac/tuwien/sepm/assignment/individual/integration/OwnerEndpointTest.java
View file @
c10bbb59
...
...
@@ -195,24 +195,7 @@ public class OwnerEndpointTest {
assertEquals
(
newOwner
.
getId
(),
response
.
getBody
().
getId
());
assertEquals
(
newOwner
.
getName
(),
response
.
getBody
().
getName
());
}
@Test
@DisplayName
(
"Deleting an existing owner without horses will return HTTP 204"
)
public
void
deletingOwner_existingNoOwnersOwned_shouldReturnStatus204
()
{
// Create the owner
OwnerDto
newOwner
=
new
OwnerDto
(
"Chad"
);
HttpEntity
<
OwnerDto
>
request
=
new
HttpEntity
<>(
newOwner
);
ResponseEntity
<
OwnerDto
>
response
=
REST_TEMPLATE
.
exchange
(
BASE_URL
+
port
+
OWNER_URL
,
HttpMethod
.
POST
,
request
,
OwnerDto
.
class
);
// Delete and test if deleted
ResponseEntity
res
=
REST_TEMPLATE
.
exchange
(
BASE_URL
+
port
+
OWNER_URL
+
'/'
+
response
.
getBody
().
getId
(),
HttpMethod
.
DELETE
,
null
,
new
ParameterizedTypeReference
<
OwnerDto
>()
{});
assertEquals
(
res
.
getStatusCode
(),
HttpStatus
.
NO_CONTENT
);
}
@Test
@DisplayName
(
"Deleting an existing owner without horses will return HTTP 204"
)
public
void
deletingOwner_existingNoHorsesOwned_shouldReturnStatus204
()
{
...
...
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