diff --git a/src/main/java/com/sitblueprint/admin/model/users/Role.java b/src/main/java/com/sitblueprint/admin/model/users/Role.java index ebafe7f..05e286f 100644 --- a/src/main/java/com/sitblueprint/admin/model/users/Role.java +++ b/src/main/java/com/sitblueprint/admin/model/users/Role.java @@ -28,4 +28,8 @@ public class Role { @ManyToMany(mappedBy = "roles") private Set members; + + public static Role of(String name) { + return Role.builder().name(name).build(); + } } diff --git a/src/test/java/com/sitblueprint/admin/service/users/MemberServiceTest.java b/src/test/java/com/sitblueprint/admin/service/users/MemberServiceTest.java index 889cf29..5738e81 100644 --- a/src/test/java/com/sitblueprint/admin/service/users/MemberServiceTest.java +++ b/src/test/java/com/sitblueprint/admin/service/users/MemberServiceTest.java @@ -13,12 +13,14 @@ import com.sitblueprint.admin.dtos.member.MemberDTO; import com.sitblueprint.admin.dtos.member.RegistrationRequestDTO; import com.sitblueprint.admin.model.users.Member; +import com.sitblueprint.admin.model.users.Role; import com.sitblueprint.admin.model.users.Token; import com.sitblueprint.admin.repository.users.MemberRepository; import java.util.Collections; import java.util.List; import java.util.NoSuchElementException; import java.util.Optional; +import java.util.Set; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -41,7 +43,7 @@ public class MemberServiceTest { void setUp() { memberService = new MemberServiceImpl(memberRepository, tokenService); testMember = Member.builder().id(1L).username("testUsername").name("Test Name").password("Test Password") - .isActive(true).build(); + .isActive(true).roles(Set.of(Role.of("E-BOARD"))).build(); testMemberDTO = testMember.toDTO(); } diff --git a/src/test/java/com/sitblueprint/admin/service/users/TeamServiceTest.java b/src/test/java/com/sitblueprint/admin/service/users/TeamServiceTest.java deleted file mode 100644 index f0028be..0000000 --- a/src/test/java/com/sitblueprint/admin/service/users/TeamServiceTest.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.sitblueprint.admin.service.users; - -import com.sitblueprint.admin.model.users.Team; -import com.sitblueprint.admin.repository.users.AttendanceRepository; -import com.sitblueprint.admin.repository.users.TeamRepository; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; - -@ExtendWith(MockitoExtension.class) -public class TeamServiceTest { - @Mock - TeamRepository teamRepository; - - @Mock - AttendanceRepository attendanceRepository; - - private TeamService teamService; - private Team testTeam; -}