Skip to content

Commit

Permalink
make rating double
Browse files Browse the repository at this point in the history
  • Loading branch information
Borislav Kavalov committed Jul 15, 2024
1 parent 9bf3d31 commit 71cd594
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class CommentDto {
private Long playgroundId;

@JsonProperty("rating")
private Integer rating;
private Double rating;

@JsonProperty("username")
private String username;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void testSaveComment() throws Exception {
public void testGetCommentsByUserId() throws Exception {
CommentDto commentDto = CommentDto.builder()
.text("Sample Comment")
.rating(5)
.rating(3.5)
.username("Sample Username")
.createdAt(new Date())
.build();
Expand All @@ -67,15 +67,15 @@ public void testGetCommentsByUserId() throws Exception {
.param("userId", "1"))
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].text").value("Sample Comment"))
.andExpect(jsonPath("$[0].rating").value(5))
.andExpect(jsonPath("$[0].rating").value(3.5))
.andExpect(jsonPath("$[0].username").value("Sample Username"));
}

@Test
public void testGetComment() throws Exception {
CommentDto commentDto = CommentDto.builder()
.text("Sample Comment")
.rating(5)
.rating(3.5)
.username("Sample Username")
.createdAt(new Date())
.build();
Expand All @@ -85,7 +85,7 @@ public void testGetComment() throws Exception {
mockMvc.perform(get(AppRestEndpoints.V1.Comments.BY_ID, 1L))
.andExpect(status().isOk())
.andExpect(jsonPath("$.text").value("Sample Comment"))
.andExpect(jsonPath("$.rating").value(5))
.andExpect(jsonPath("$.rating").value(3.5))
.andExpect(jsonPath("$.username").value("Sample Username"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CommentServiceTest {
void setUp() {
commentDto = CommentDto.builder()
.text("Test Comment")
.rating(5)
.rating(3.5)
.username("Sample Username")
.playgroundId(1L)
.build();
Expand All @@ -69,7 +69,7 @@ void setUp() {
comment = Comment.builder()
.id(1L)
.text("Test Comment")
.rating(5)
.rating(3.5)
.createdByUser(user)
.playground(playground)
.build();
Expand Down

0 comments on commit 71cd594

Please sign in to comment.