Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@
import com.example.solidconnection.location.country.domain.Country;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface CountryRepository extends JpaRepository<Country, Long> {

List<Country> findAllByKoreanNameIn(List<String> koreanNames);

@Query("""
SELECT DISTINCT c.koreanName
FROM Country c
WHERE c.code IN (
SELECT ic.countryCode
FROM InterestedCountry ic
WHERE ic.siteUserId = :siteUserId
)
""")
List<String> findKoreanNamesBySiteUserId(@Param("siteUserId") long siteUserId);
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.example.solidconnection.siteuser.dto;

import static com.fasterxml.jackson.annotation.JsonInclude.Include.*;

import com.example.solidconnection.siteuser.domain.AuthType;
import com.example.solidconnection.siteuser.domain.Role;
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

public record MyPageResponse(
String nickname,
Expand All @@ -15,9 +19,15 @@ public record MyPageResponse(
int likedMentorCount,

@JsonProperty("likedUniversityCount")
int likedUnivApplyInfoCount) {
int likedUnivApplyInfoCount,

@JsonInclude(NON_NULL)
List<String> interestedCountries,
Copy link
Collaborator

@nayonsoso nayonsoso Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List<String> 를 응답하는 부분에서 고민되긴 하네요🤔
ui 상으로는 그냥 국가 이름 하나만 있어서요.
게시물에서 첫번째 이미지의 썸네일만 내려주는 것처럼 하나만 내려줘야할지? 아니면 목록으로 다 내려줘야할지...

개인적인 판단으로는 지금처럼 List<String> 으로 전달하여 전체를 다 보여주는게 좋을 것 같긴한데, 기획팀과 이야기가 되어야 할 것 같습니다.
혹시 이와 관련된 내용이 이야기된적이 있었던가요..?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 처음엔 String으로만 하려고 했으나... 디비엔 List로 들어가있어서 영서님 생각처럼 다 보여주는 게 나을 거 같다고 생각했습니다..
기획팀에 따로 이야기는 안했어서 여쭤보겠습니다!


@JsonInclude(NON_NULL)
String attendedUniversity) {

public static MyPageResponse of(SiteUser siteUser, int likedUnivApplyInfoCount) {
public static MyPageResponse of(SiteUser siteUser, int likedUnivApplyInfoCount, List<String> interestedCountries, String attendedUniversity) {
return new MyPageResponse(
siteUser.getNickname(),
siteUser.getProfileImageUrl(),
Expand All @@ -26,7 +36,9 @@ public static MyPageResponse of(SiteUser siteUser, int likedUnivApplyInfoCount)
siteUser.getEmail(),
0, // TODO: 커뮤니티 기능 생기면 업데이트 필요
0, // TODO: 멘토 기능 생기면 업데이트 필요
likedUnivApplyInfoCount
likedUnivApplyInfoCount,
interestedCountries,
attendedUniversity
);
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
package com.example.solidconnection.siteuser.service;

import static com.example.solidconnection.common.exception.ErrorCode.CAN_NOT_CHANGE_NICKNAME_YET;
import static com.example.solidconnection.common.exception.ErrorCode.MENTOR_NOT_FOUND;
import static com.example.solidconnection.common.exception.ErrorCode.NICKNAME_ALREADY_EXISTED;
import static com.example.solidconnection.common.exception.ErrorCode.PASSWORD_MISMATCH;
import static com.example.solidconnection.common.exception.ErrorCode.UNIVERSITY_NOT_FOUND;
import static com.example.solidconnection.common.exception.ErrorCode.USER_NOT_FOUND;

import com.example.solidconnection.common.exception.CustomException;
import com.example.solidconnection.location.country.repository.CountryRepository;
import com.example.solidconnection.mentor.domain.Mentor;
import com.example.solidconnection.mentor.repository.MentorRepository;
import com.example.solidconnection.s3.domain.ImgType;
import com.example.solidconnection.s3.dto.UploadedFileUrlResponse;
import com.example.solidconnection.s3.service.S3Service;
import com.example.solidconnection.siteuser.domain.Role;
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.siteuser.dto.MyPageResponse;
import com.example.solidconnection.siteuser.dto.PasswordUpdateRequest;
import com.example.solidconnection.siteuser.repository.SiteUserRepository;
import com.example.solidconnection.university.domain.University;
import com.example.solidconnection.university.repository.LikedUnivApplyInfoRepository;
import com.example.solidconnection.university.repository.UniversityRepository;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
Expand All @@ -32,6 +41,9 @@ public class MyPageService {
private final PasswordEncoder passwordEncoder;
private final SiteUserRepository siteUserRepository;
private final LikedUnivApplyInfoRepository likedUnivApplyInfoRepository;
private final CountryRepository countryRepository;
private final MentorRepository mentorRepository;
private final UniversityRepository universityRepository;
private final S3Service s3Service;

/*
Expand All @@ -42,7 +54,19 @@ public MyPageResponse getMyPageInfo(long siteUserId) {
SiteUser siteUser = siteUserRepository.findById(siteUserId)
.orElseThrow(() -> new CustomException(USER_NOT_FOUND));
int likedUnivApplyInfoCount = likedUnivApplyInfoRepository.countBySiteUserId(siteUser.getId());
return MyPageResponse.of(siteUser, likedUnivApplyInfoCount);

List<String> interestedCountries = null;
String universityKoreanName = null;
if (siteUser.getRole() == Role.MENTEE) {
interestedCountries = countryRepository.findKoreanNamesBySiteUserId(siteUser.getId());
} else if (siteUser.getRole() == Role.MENTOR) {
Comment on lines +60 to +62
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

관심 국가 목록의 중복 제거와 정렬 보장 확인 필요

  1. 응답의 일관성을 위해 DISTINCT 적용 및 정렬 기준(예: 가나다순)을 Repository 쿼리에서 보장하는지 확인이 필요합니다.
  2. 사용자 경험을 위해 정렬 기준이 명확하면 좋습니다(테스트에서도 검증 가능).

검증 스크립트(Repository 쿼리 확인):


🏁 Script executed:

#!/bin/bash
# CountryRepository의 findKoreanNamesBySiteUserId 쿼리에 DISTINCT/ORDER BY가 있는지 확인
rg -n "findKoreanNamesBySiteUserId" -A 6 -B 3

Length of output: 2196


🏁 Script executed:

#!/bin/bash
set -euo pipefail
file="src/main/java/com/example/solidconnection/location/country/repository/CountryRepository.java"
echo "== FILE: $file =="
sed -n '1,240p' "$file" || true

Length of output: 1272


확인: DISTINCT는 적용되어 있으나 정렬(ORDER BY)이 없어 추가가 필요합니다
CountryRepository.findKoreanNamesBySiteUserId 쿼리에 SELECT DISTINCT는 이미 적용되어 있습니다.
하지만 ORDER BY가 없어 반환되는 국가 목록의 정렬(예: 가나다순)이 보장되지 않습니다.
권장 변경은 쿼리 끝에 ORDER BY c.koreanName ASC를 명시해 응답 일관성을 확보하는 것입니다.

  1. 정렬 쿼리 추가.

    • 파일: src/main/java/com/example/solidconnection/location/country/repository/CountryRepository.java.
    • 제안: 쿼리 끝에 ORDER BY c.koreanName ASC 추가 (예: ORDER BY c.koreanName ASC).
  2. 테스트 추가.

    • 제안: Repository 또는 MyPageService 단위/통합 테스트에서 반환되는 국가 목록이 중복 없이 정렬되어 있는지 검증하세요.
    • 참고: MyPageService의 호출부(src/main/java/com/example/solidconnection/siteuser/service/MyPageService.java, 라인 60-62)는 변경 불필요합니다.
🤖 Prompt for AI Agents
In
src/main/java/com/example/solidconnection/location/country/repository/CountryRepository.java
(update the query used by findKoreanNamesBySiteUserId) add an ORDER BY clause so
the query ends with "ORDER BY c.koreanName ASC" to guarantee consistent
alphabetical ordering of distinct Korean names; then add a repository or service
unit/integration test that calls the repository (or MyPageService) to assert the
returned list contains no duplicates and is sorted ascending by koreanName; note
MyPageService
(src/main/java/com/example/solidconnection/siteuser/service/MyPageService.java
lines 60-62) does not require changes.

Mentor mentor = mentorRepository.findBySiteUserId(siteUser.getId())
.orElseThrow(() -> new CustomException(MENTOR_NOT_FOUND));
University university = universityRepository.findById(mentor.getUniversityId())
.orElseThrow(() -> new CustomException(UNIVERSITY_NOT_FOUND));
universityKoreanName = university.getKoreanName();
Comment on lines +63 to +67
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

멘토의 대학 ID null 처리 누락: IllegalArgumentException 가능성

멘토는 존재하지만 mentor.getUniversityId()가 null이면 repository.findById(null) 호출로 IllegalArgumentException이 발생할 수 있습니다. 도메인 제약이 있더라도 방어 코드를 둬야 운영 안전성이 올라갑니다.

  • 제안: universityId null 가드 후, 명시적으로 UNIVERSITY_NOT_FOUND 예외를 던지세요.

적용 diff:

             Mentor mentor = mentorRepository.findBySiteUserId(siteUser.getId())
                     .orElseThrow(() -> new CustomException(MENTOR_NOT_FOUND));
-            University university = universityRepository.findById(mentor.getUniversityId())
+            Long universityId = mentor.getUniversityId();
+            if (universityId == null) {
+                throw new CustomException(UNIVERSITY_NOT_FOUND);
+            }
+            University university = universityRepository.findById(universityId)
                     .orElseThrow(() -> new CustomException(UNIVERSITY_NOT_FOUND));
             universityKoreanName = university.getKoreanName();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Mentor mentor = mentorRepository.findBySiteUserId(siteUser.getId())
.orElseThrow(() -> new CustomException(MENTOR_NOT_FOUND));
University university = universityRepository.findById(mentor.getUniversityId())
.orElseThrow(() -> new CustomException(UNIVERSITY_NOT_FOUND));
universityKoreanName = university.getKoreanName();
Mentor mentor = mentorRepository.findBySiteUserId(siteUser.getId())
.orElseThrow(() -> new CustomException(MENTOR_NOT_FOUND));
Long universityId = mentor.getUniversityId();
if (universityId == null) {
throw new CustomException(UNIVERSITY_NOT_FOUND);
}
University university = universityRepository.findById(universityId)
.orElseThrow(() -> new CustomException(UNIVERSITY_NOT_FOUND));
universityKoreanName = university.getKoreanName();
🤖 Prompt for AI Agents
In src/main/java/com/example/solidconnection/siteuser/service/MyPageService.java
around lines 63 to 67, the code calls
universityRepository.findById(mentor.getUniversityId()) without guarding against
mentor.getUniversityId() being null, which can throw IllegalArgumentException;
add a null check for mentor.getUniversityId() and if null explicitly throw new
CustomException(UNIVERSITY_NOT_FOUND) before calling findById, otherwise proceed
to call findById and retrieve university.getKoreanName().

}
return MyPageResponse.of(siteUser, likedUnivApplyInfoCount, interestedCountries, universityKoreanName);
}

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@
package com.example.solidconnection.siteuser.service;

import static com.example.solidconnection.common.exception.ErrorCode.CAN_NOT_CHANGE_NICKNAME_YET;
import static com.example.solidconnection.common.exception.ErrorCode.PASSWORD_MISMATCH;
import static com.example.solidconnection.siteuser.service.MyPageService.MIN_DAYS_BETWEEN_NICKNAME_CHANGES;
import static com.example.solidconnection.siteuser.service.MyPageService.NICKNAME_LAST_CHANGE_DATE_FORMAT;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatCode;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.mockito.BDDMockito.any;
import static org.mockito.BDDMockito.eq;
import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.never;
import static org.mockito.BDDMockito.then;

import com.example.solidconnection.common.exception.CustomException;
import com.example.solidconnection.location.country.domain.Country;
import com.example.solidconnection.location.country.domain.InterestedCountry;
import com.example.solidconnection.location.country.fixture.CountryFixture;
import com.example.solidconnection.location.country.repository.InterestedCountryRepository;
import com.example.solidconnection.mentor.fixture.MentorFixture;
import com.example.solidconnection.s3.domain.ImgType;
import com.example.solidconnection.s3.dto.UploadedFileUrlResponse;
import com.example.solidconnection.s3.service.S3Service;
import com.example.solidconnection.siteuser.domain.AuthType;
import com.example.solidconnection.siteuser.domain.Role;
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.siteuser.dto.MyPageResponse;
import com.example.solidconnection.siteuser.dto.PasswordUpdateRequest;
import com.example.solidconnection.siteuser.fixture.SiteUserFixture;
import com.example.solidconnection.siteuser.fixture.SiteUserFixtureBuilder;
import com.example.solidconnection.siteuser.repository.SiteUserRepository;
import com.example.solidconnection.support.TestContainerSpringBootTest;
import com.example.solidconnection.university.domain.LikedUnivApplyInfo;
import com.example.solidconnection.university.domain.University;
import com.example.solidconnection.university.fixture.UnivApplyInfoFixture;
import com.example.solidconnection.university.repository.LikedUnivApplyInfoRepository;
import java.time.LocalDateTime;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
Expand All @@ -56,9 +59,18 @@ class MyPageServiceTest {
@Autowired
private LikedUnivApplyInfoRepository likedUnivApplyInfoRepository;

@Autowired
private InterestedCountryRepository interestedCountryRepository;

@Autowired
private SiteUserFixture siteUserFixture;

@Autowired
private MentorFixture mentorFixture;

@Autowired
private CountryFixture countryFixture;

@Autowired
private UnivApplyInfoFixture univApplyInfoFixture;

Expand All @@ -76,25 +88,94 @@ void setUp() {
}

@Test
void 마이페이지_정보를_조회한다() {
void 멘티의_마이페이지_정보를_조회한다() {
// given
int likedUnivApplyInfoCount = createLikedUnivApplyInfos(user);
Country country = countryFixture.미국();
InterestedCountry interestedCountry = new InterestedCountry(user, country);
interestedCountryRepository.save(interestedCountry);

// when
MyPageResponse response = myPageService.getMyPageInfo(user.getId());

// then
assertAll(
Assertions.assertAll(
() -> assertThat(response.nickname()).isEqualTo(user.getNickname()),
() -> assertThat(response.profileImageUrl()).isEqualTo(user.getProfileImageUrl()),
() -> assertThat(response.role()).isEqualTo(user.getRole()),
() -> assertThat(response.email()).isEqualTo(user.getEmail()),
// () -> assertThat(response.likedPostCount()).isEqualTo(user.getLikedPostList().size()),
// todo : 좋아요한 게시물 수 반환 기능 추가와 함께 수정요망
() -> assertThat(response.likedUnivApplyInfoCount()).isEqualTo(likedUnivApplyInfoCount)
() -> assertThat(response.likedUnivApplyInfoCount()).isEqualTo(likedUnivApplyInfoCount),
() -> assertThat(response.interestedCountries().get(0)).isEqualTo(country.getKoreanName()),
() -> assertThat(response.attendedUniversity()).isNull()
);
}

@Test
void 멘토의_마이페이지_정보를_조회한다() {
// given
SiteUser mentorUser = siteUserFixture.멘토(1, "mentor");
University university = univApplyInfoFixture.괌대학_A_지원_정보().getUniversity();
mentorFixture.멘토(mentorUser.getId(), university.getId());
int likedUnivApplyInfoCount = createLikedUnivApplyInfos(mentorUser);

// when
MyPageResponse response = myPageService.getMyPageInfo(mentorUser.getId());

// then
Assertions.assertAll(
() -> assertThat(response.nickname()).isEqualTo(mentorUser.getNickname()),
() -> assertThat(response.profileImageUrl()).isEqualTo(mentorUser.getProfileImageUrl()),
() -> assertThat(response.role()).isEqualTo(mentorUser.getRole()),
() -> assertThat(response.email()).isEqualTo(mentorUser.getEmail()),
// () -> assertThat(response.likedPostCount()).isEqualTo(user.getLikedPostList().size()),
// todo : 좋아요한 게시물 수 반환 기능 추가와 함께 수정요망
() -> assertThat(response.likedUnivApplyInfoCount()).isEqualTo(likedUnivApplyInfoCount),
() -> assertThat(response.attendedUniversity()).isEqualTo(university.getKoreanName()),
() -> assertThat(response.interestedCountries()).isNull()
);
}
Comment on lines +115 to +138
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

멘토 경로의 예외 시나리오 테스트 추가 제안 (커버리지 보강)

  1. 멘토-사용자 존재하지만 Mentor 레코드 없음 → MENTOR_NOT_FOUND.
  2. Mentor 존재하지만 universityId null 또는 존재하지 않음 → UNIVERSITY_NOT_FOUND.
  3. 위 두 케이스는 서비스가 명시적으로 예외를 던지므로 반드시 회귀 테스트로 커버하는 게 안전합니다.

참고 테스트 스니펫(새 메서드로 추가 권장):

@Test
void 멘토정보가_없으면_예외를_던진다() {
    // given
    SiteUser mentorUser = siteUserFixture.멘토(1, "mentorWithoutRecord");
    // mentorFixture.멘토(...) 호출 생략으로 Mentor 미생성

    // when & then
    Assertions.assertAll(
        () -> org.assertj.core.api.Assertions.assertThatThrownBy(
                () -> myPageService.getMyPageInfo(mentorUser.getId()))
            .isInstanceOf(CustomException.class)
            .hasMessageContaining("MENTOR_NOT_FOUND")
    );
}

@Test
void 멘토의_대학정보가_없으면_예외를_던진다() {
    // given
    SiteUser mentorUser = siteUserFixture.멘토(1, "mentorNoUniv");
    // mentorFixture를 사용해 universityId를 null로 생성 가능한지 확인 필요
    // (불가하면 잘못된 universityId를 주입하여 UNIVERSITY_NOT_FOUND를 유도)

    // when & then
    org.assertj.core.api.Assertions.assertThatThrownBy(
            () -> myPageService.getMyPageInfo(mentorUser.getId()))
        .isInstanceOf(CustomException.class)
        .hasMessageContaining("UNIVERSITY_NOT_FOUND");
}

원하시면 픽스처에 universityId null 케이스 지원을 위한 헬퍼도 추가해 드리겠습니다.

🤖 Prompt for AI Agents
In
src/test/java/com/example/solidconnection/siteuser/service/MyPageServiceTest.java
around lines 115 to 138, add two new test methods to cover mentor-path exception
scenarios: (1) create a SiteUser via siteUserFixture as a mentor user but do NOT
create a Mentor record, then call myPageService.getMyPageInfo(userId) and assert
that it throws the expected CustomException with a message containing
"MENTOR_NOT_FOUND"; (2) create a SiteUser and a Mentor record whose universityId
is null or an invalid/non-existent id (use fixture helper or inject a bad id),
then call myPageService.getMyPageInfo(userId) and assert that it throws
CustomException with a message containing "UNIVERSITY_NOT_FOUND"; use
assertThatThrownBy for assertions and follow existing fixture patterns for
setup.


private int createLikedUnivApplyInfos(SiteUser testUser) {
LikedUnivApplyInfo likedUnivApplyInfo1 = new LikedUnivApplyInfo(null, univApplyInfoFixture.괌대학_A_지원_정보().getId(), testUser.getId());
LikedUnivApplyInfo likedUnivApplyInfo2 = new LikedUnivApplyInfo(null, univApplyInfoFixture.메이지대학_지원_정보().getId(), testUser.getId());
LikedUnivApplyInfo likedUnivApplyInfo3 = new LikedUnivApplyInfo(null, univApplyInfoFixture.코펜하겐IT대학_지원_정보().getId(), testUser.getId());

likedUnivApplyInfoRepository.save(likedUnivApplyInfo1);
likedUnivApplyInfoRepository.save(likedUnivApplyInfo2);
likedUnivApplyInfoRepository.save(likedUnivApplyInfo3);
return likedUnivApplyInfoRepository.countBySiteUserId(testUser.getId());
}

private MockMultipartFile createValidImageFile() {
return new MockMultipartFile(
"image",
"test.jpg",
"image/jpeg",
"test image content".getBytes()
);
}

private String createExpectedErrorMessage(LocalDateTime modifiedAt) {
String formatLastModifiedAt = String.format(
"(마지막 수정 시간 : %s)",
NICKNAME_LAST_CHANGE_DATE_FORMAT.format(modifiedAt)
);
return CAN_NOT_CHANGE_NICKNAME_YET.getMessage() + " : " + formatLastModifiedAt;
}

private SiteUser createSiteUserWithCustomProfile() {
return siteUserFixtureBuilder.siteUser()
.email("[email protected]")
.authType(AuthType.EMAIL)
.nickname("커스텀프로필")
.profileImageUrl("profile/profileImageUrl")
.role(Role.MENTEE)
.password("customPassword123")
.create();
}

@Nested
class 프로필_이미지_수정_테스트 {

Expand Down Expand Up @@ -182,87 +263,4 @@ void setUp() {
.hasMessage(createExpectedErrorMessage(modifiedAt));
}
}

@Nested
class 비밀번호_변경_테스트 {

private String currentPassword;
private String newPassword;

@BeforeEach
void setUp() {
currentPassword = "currentPassword123";
newPassword = "newPassword123";

user.updatePassword(passwordEncoder.encode(currentPassword));
siteUserRepository.save(user);
}

@Test
void 비밀번호를_성공적으로_변경한다() {
// given
PasswordUpdateRequest request = new PasswordUpdateRequest(currentPassword, newPassword, newPassword);

// when
myPageService.updatePassword(user.getId(), request);

// then
SiteUser updatedUser = siteUserRepository.findById(user.getId()).get();
assertAll(
() -> assertThat(passwordEncoder.matches(newPassword, updatedUser.getPassword())).isTrue(),
() -> assertThat(passwordEncoder.matches(currentPassword, updatedUser.getPassword())).isFalse()
);
}

@Test
void 현재_비밀번호가_일치하지_않으면_예외가_발생한다() {
// given
String wrongPassword = "wrongPassword";
PasswordUpdateRequest request = new PasswordUpdateRequest(wrongPassword, newPassword, newPassword);

// when & then
assertThatThrownBy(() -> myPageService.updatePassword(user.getId(), request))
.isInstanceOf(CustomException.class)
.hasMessage(PASSWORD_MISMATCH.getMessage());
}
}

private int createLikedUnivApplyInfos(SiteUser testUser) {
LikedUnivApplyInfo likedUnivApplyInfo1 = new LikedUnivApplyInfo(null, univApplyInfoFixture.괌대학_A_지원_정보().getId(), testUser.getId());
LikedUnivApplyInfo likedUnivApplyInfo2 = new LikedUnivApplyInfo(null, univApplyInfoFixture.메이지대학_지원_정보().getId(), testUser.getId());
LikedUnivApplyInfo likedUnivApplyInfo3 = new LikedUnivApplyInfo(null, univApplyInfoFixture.코펜하겐IT대학_지원_정보().getId(), testUser.getId());

likedUnivApplyInfoRepository.save(likedUnivApplyInfo1);
likedUnivApplyInfoRepository.save(likedUnivApplyInfo2);
likedUnivApplyInfoRepository.save(likedUnivApplyInfo3);
return likedUnivApplyInfoRepository.countBySiteUserId(testUser.getId());
}

private MockMultipartFile createValidImageFile() {
return new MockMultipartFile(
"image",
"test.jpg",
"image/jpeg",
"test image content".getBytes()
);
}

private String createExpectedErrorMessage(LocalDateTime modifiedAt) {
String formatLastModifiedAt = String.format(
"(마지막 수정 시간 : %s)",
NICKNAME_LAST_CHANGE_DATE_FORMAT.format(modifiedAt)
);
return CAN_NOT_CHANGE_NICKNAME_YET.getMessage() + " : " + formatLastModifiedAt;
}

private SiteUser createSiteUserWithCustomProfile() {
return siteUserFixtureBuilder.siteUser()
.email("[email protected]")
.authType(AuthType.EMAIL)
.nickname("커스텀프로필")
.profileImageUrl("profile/profileImageUrl")
.role(Role.MENTEE)
.password("customPassword123")
.create();
}
}
Loading