Skip to content

Commit

Permalink
fix build and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bhtibrewal committed May 19, 2024
1 parent dafa252 commit 2feb830
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package com.RDS.skilltree.Endorsement;

import com.RDS.skilltree.Common.Response.GenericResponse;
import com.RDS.skilltree.Exceptions.EntityAlreadyExistsException;
import com.RDS.skilltree.Exceptions.InvalidParameterException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.RDS.skilltree.Exceptions.NoEntityException;
import com.RDS.skilltree.Skill.SkillModel;
import com.RDS.skilltree.Skill.SkillRepository;
import com.RDS.skilltree.User.UserModel;
import com.RDS.skilltree.User.UserRepository;
import com.RDS.skilltree.User.UserRole;
import com.fasterxml.jackson.core.type.TypeReference;
Expand Down Expand Up @@ -643,23 +644,22 @@ public void itShouldReturnInvalidStatusGivenInvalidEndorsementStatus() {
public void itShouldThrowEntityAlreadyExistsExceptionGivenEndorsementIsUpdated() {
setupUpdateEndorsementTests(true);

UUID userId = UUID.randomUUID();
UUID endorseeId = UUID.randomUUID();
UUID skillId = UUID.randomUUID();
UUID endorsementId = UUID.randomUUID();

UserModel mockUser = UserModel.builder().id(userId).build();
SkillModel mockSkill = SkillModel.builder().id(skillId).build();
EndorsementModel mockEndorsement =
EndorsementModel.builder()
.id(endorsementId)
.status(EndorsementStatus.APPROVED)
.user(mockUser)
.endorseeId(endorseeId)
.skill(mockSkill)
.build();
mockEndorsement.setCreatedAt(Instant.now());
mockEndorsement.setUpdatedAt(Instant.now());
mockEndorsement.setCreatedBy(mockUser);
mockEndorsement.setUpdatedBy(mockUser);
mockEndorsement.setCreatedBy(endorseeId);
mockEndorsement.setUpdatedBy(endorseeId);

when(endorsementRepository.findById(endorsementId)).thenReturn(Optional.of(mockEndorsement));

Expand Down Expand Up @@ -699,24 +699,23 @@ public void itShouldReturnEndorsementNotFoundGivenUnknownEndorsementId() {
public void itShouldUpdateEndorsementStatusGivenEndorsementIdAndStatusApprovedOrRejected() {
setupUpdateEndorsementTests(true);

UUID userId = UUID.randomUUID();
UUID endorseeId = UUID.randomUUID();
UUID skillId = UUID.randomUUID();
UUID endorsementId = UUID.randomUUID();
EndorsementStatus status = EndorsementStatus.APPROVED;

UserModel mockUser = UserModel.builder().id(userId).build();
SkillModel mockSkill = SkillModel.builder().id(skillId).build();
EndorsementModel mockEndorsement =
EndorsementModel.builder()
.id(endorsementId)
.status(EndorsementStatus.PENDING)
.user(mockUser)
.endorseeId(endorseeId)
.skill(mockSkill)
.build();
mockEndorsement.setCreatedAt(Instant.now());
mockEndorsement.setUpdatedAt(Instant.now());
mockEndorsement.setCreatedBy(mockUser);
mockEndorsement.setUpdatedBy(mockUser);
mockEndorsement.setCreatedBy(endorseeId);
mockEndorsement.setUpdatedBy(endorseeId);

when(endorsementRepository.findById(endorsementId)).thenReturn(Optional.of(mockEndorsement));

Expand All @@ -729,14 +728,14 @@ public void itShouldUpdateEndorsementStatusGivenEndorsementIdAndStatusApprovedOr
EndorsementModel updatedMockEndorsement =
EndorsementModel.builder()
.id(endorsementId)
.user(mockUser)
.endorseeId(endorseeId)
.skill(mockSkill)
.status(EndorsementStatus.APPROVED)
.build();
mockEndorsement.setCreatedAt(Instant.now());
mockEndorsement.setUpdatedAt(Instant.now());
mockEndorsement.setCreatedBy(mockUser);
mockEndorsement.setUpdatedBy(mockUser);
mockEndorsement.setCreatedBy(endorseeId);
mockEndorsement.setUpdatedBy(endorseeId);

when(endorsementRepository.findById(endorsementId))
.thenReturn(Optional.of(updatedMockEndorsement));
Expand Down

0 comments on commit 2feb830

Please sign in to comment.