Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat #74] enum 클래스에 직군, 직렬 추가하기 #78

Merged
merged 6 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions src/main/java/com/dnd/gongmuin/member/domain/JobCategory.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,52 @@
@RequiredArgsConstructor
public enum JobCategory {

GAS("가스"); // TODO: 7/20/24 필드 추가
hyun2371 marked this conversation as resolved.
Show resolved Hide resolved
GME("일반기계"),
AM("농업기계"),
ELEC("전자"),
TEXT("섬유"),
GCE("일반화공"),

ME("기계"),
HT("난방"),
TM("열관리"),
OP("운전"),

SM("경비관리"),

BME("의공"),
ENV("환경"),
PH("보건"),
SAN("위생"),
PHARM("약무"),
PATH("병리"),
RAD("방사선"),
RT("재활치료"),
MR("의무기록"),

NA("간호조무"),
CK("조리"),

IA("조사사무"),
CM("법정경위"),
CW("사무"),
AS("행정사무"),
CA("법원사무"),
SG("속기"),

VI("영상"),
EO("전기 운영"),

CO("교정"),
AD("행정"),
TX("세무"),
ST("통계"),
AU("감사"),
EA("교육행정"),
LB("사서"),
CS("관세"),
SW("사회복지");


private final String label;

Expand All @@ -26,4 +71,4 @@ public static JobCategory from(String input) {
private boolean isEqual(String input) {
return input.equals(this.label);
}
}
}
11 changes: 8 additions & 3 deletions src/main/java/com/dnd/gongmuin/member/domain/JobGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
@RequiredArgsConstructor
public enum JobGroup {

ENGINEERING("공업"),
ADMINISTRATION("행정"),
MACHINE("기계");
ENG("공업"),
ME("기계"),
CSM("법원경비관리"),
PH("보건"),
PHH("보건위생"),
JA("사법행정사무"),
ICT("정보통신"),
AD("행정");

private final String label;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import jakarta.servlet.http.Cookie;

@DisplayName("[AuthController] 통합테스트")
public class AuthControllerTest extends ApiTestSupport {
class AuthControllerTest extends ApiTestSupport {

@Autowired
private MemberRepository memberRepository;
Expand Down Expand Up @@ -64,7 +64,7 @@ void checkNickName() throws Exception {
@Test
void signUp() throws Exception {
// given
AdditionalInfoRequest request = new AdditionalInfoRequest("[email protected]", "회원", "공업", "가스");
AdditionalInfoRequest request = new AdditionalInfoRequest("[email protected]", "회원", "공업", "일반기계");

Member savedMember = memberRepository.save(MemberFixture.member3());
AuthInfo authInfo = AuthInfo.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import com.dnd.gongmuin.auth.repository.AuthRepository;
import com.dnd.gongmuin.common.fixture.AuthFixture;
import com.dnd.gongmuin.common.fixture.MemberFixture;
import com.dnd.gongmuin.member.domain.JobCategory;
import com.dnd.gongmuin.member.domain.JobGroup;
import com.dnd.gongmuin.member.domain.Member;
import com.dnd.gongmuin.member.repository.MemberRepository;
import com.dnd.gongmuin.member.service.MemberService;
Expand Down Expand Up @@ -144,7 +146,7 @@ void isDuplicatedNickname() {
@Test
void signUp() {
// given
AdditionalInfoRequest request = new AdditionalInfoRequest("[email protected]", "김신규", "공업", "가스");
AdditionalInfoRequest request = new AdditionalInfoRequest("[email protected]", "김신규", "공업", "일반기계");
MockHttpServletResponse mockResponse = new MockHttpServletResponse();

Member member1 = MemberFixture.member3();
Expand All @@ -159,8 +161,8 @@ void signUp() {
.containsExactlyInAnyOrder(
"[email protected]",
"김신규",
GAS,
ENGINEERING
JobGroup.ME,
JobCategory.ME
);
}

Expand Down
16 changes: 8 additions & 8 deletions src/test/java/com/dnd/gongmuin/common/fixture/MemberFixture.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public static Member member() {
return Member.of(
"김회원",
"회원123",
JobGroup.ENGINEERING,
JobCategory.GAS,
JobGroup.ENG,
JobCategory.ME,
"KAKAO123/[email protected]",
"[email protected]",
10000,
Expand All @@ -31,8 +31,8 @@ public static Member member2() {
return Member.of(
"회원",
"소셜회원",
JobGroup.ENGINEERING,
JobCategory.GAS,
JobGroup.ENG,
JobCategory.ME,
"KAKAO123/[email protected]",
"[email protected]",
20000,
Expand All @@ -53,8 +53,8 @@ public static Member member4() {
return Member.of(
"회원",
"소셜회원",
JobGroup.ADMINISTRATION,
JobCategory.GAS,
JobGroup.AD,
JobCategory.ME,
"KAKAO1234/[email protected]",
"[email protected]",
20000,
Expand All @@ -66,8 +66,8 @@ public static Member member(Long memberId) {
Member member = Member.of(
"김회원",
"회원123",
JobGroup.ENGINEERING,
JobCategory.GAS,
JobGroup.ENG,
JobCategory.ME,
"KAKAO123/[email protected]",
"[email protected]",
10000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ void getMemberProfile() throws Exception {
.andExpect(status().isOk())
.andExpect(jsonPath("nickname").value("김회원"))
.andExpect(jsonPath("jobGroup").value("공업"))
.andExpect(jsonPath("jobCategory").value("가스"))
.andExpect(jsonPath("jobCategory").value("기계"))
.andExpect(jsonPath("credit").value(10000));
}

@DisplayName("로그인 된 사용자 프로필 정보를 수정한다.")
@Test
void updateMemberProfile() throws Exception {
// given
UpdateMemberProfileRequest request = new UpdateMemberProfileRequest("박회원", "행정", "가스");
UpdateMemberProfileRequest request = new UpdateMemberProfileRequest("박회원", "행정", "세무");

// when // then
mockMvc.perform(patch("/api/members/profile/edit")
Expand All @@ -86,7 +86,7 @@ void updateMemberProfile() throws Exception {
.andExpect(status().isOk())
.andExpect(jsonPath("nickname").value("박회원"))
.andExpect(jsonPath("jobGroup").value("행정"))
.andExpect(jsonPath("jobCategory").value("가스"))
.andExpect(jsonPath("jobCategory").value("세무"))
.andExpect(jsonPath("credit").value(10000));
}

Expand Down
5 changes: 4 additions & 1 deletion src/test/java/com/dnd/gongmuin/member/domain/MemberTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ void updateAdditionalInfo() {
Member member = MemberFixture.member3();

// when
member.updateAdditionalInfo("김회원", "[email protected]", ENGINEERING, GAS);
member.updateAdditionalInfo("김회원",
"[email protected]",
JobGroup.ME,
JobCategory.ME);

// then
assertThat(member).extracting("nickname", "officialEmail")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void getMemberProfileThrowException() {
void updateMemberProfile() {
// given
Member member = MemberFixture.member();
UpdateMemberProfileRequest request = new UpdateMemberProfileRequest("박회원", "공업", "가스");
UpdateMemberProfileRequest request = new UpdateMemberProfileRequest("박회원", "공업", "일반기계");

given(memberRepository.findByOfficialEmail(anyString())).willReturn(member);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void updateQuestionPost() throws Exception {
questionPost.getContent() + "ts",
null,
questionPost.getReward() + 1000,
JobGroup.ADMINISTRATION.getLabel()
JobGroup.AD.getLabel()
);
mockMvc.perform(patch("/api/question-posts/{questionPostId}/edit", questionPost.getId())
.content(toJson(request))
Expand Down
Loading