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

dev 서버용 관리자 테스트 페이지 추가 #51

Merged
merged 11 commits into from
Feb 8, 2024
Merged

Conversation

JJ503
Copy link
Member

@JJ503 JJ503 commented Feb 7, 2024

해당 관리자 테스트 페이지는 오로지 dev 서버를 위한 페이지로 안드로이드 분들께서 테스트를 보다 쉽게 진행할 수 있도록 만들었습니다.
그래서 AdminPageController는 profile이 dev, local, test에서만 사용할 수 있도록 했습니다.
추후 prod가 생기더라도 해당 profile에서는 테스트 페이지를 사용할 수 없습니다.

로컬에서 테스트 페이지는 localhost:8080/admin 접속을 통해 확인하실 수 있습니다.
또한, 값들이 제대로 들어갔는지 확인을 위해선 localhost:8080/h2-console을 통해 확인하실 수 있습니다.

또한, 관리자 테스트 페이지기에 컨벤션은 굳이 지키려 노력하지 않았습니다.
그래서 controller에서 service를 호출하기도, repository를 호출하기도 하는 상태입니다.
저는 그저 테스트의 편리성을 위해 만든 관리자 페이지에서 컨벤션을 지키려는 노력을 하는 것이 오히려 더 큰 비용이 든다고 판단해 그렇게 진행했는데 혹시 어떻게 생각하시나요?
또한, 관리자 테스트 페이지 기능들에 대한 테스트 코드가 크게 의미가 있나라는 의문이 드는 상태입니다.
그래서 컨트롤러 테스트의 경우 andDo(print())rest docs를 통한 api 명세서 작성도 하지 않았습니다.
이 부분에 대해서도 의견 주시면 감사하겠습니다!

@JJ503 JJ503 added the feature 기능 추가 label Feb 7, 2024
@JJ503 JJ503 requested a review from jhsseonn February 7, 2024 10:39
@JJ503 JJ503 self-assigned this Feb 7, 2024
Copy link
Member

@jhsseonn jhsseonn left a comment

Choose a reason for hiding this comment

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

관리자페이지 고생 많으셨습니다! 타임리프 너무 오랜만에 봐서 어버버 하면서 봤네요..ㅋㅋㅋ
저도 관리자 페이지의 경우에는 컨벤션을 지킬 필요는 없다고 생각합니다. 테스트는 더더욱 굳이? 싶어서 정수님 편하신대로 하시면 될 것 같습니다.
다만 개행 관련해서는 보이는 부분 모두 코멘트 달아두었습니다. 혹시 클래스의 첫 어노테이션은 개행하지 않는 것이 편하실까요? 저번에 이어서 이번에도 개행하지 않은 부분이 많이 보여서 이 방법이 편하시다면 이 방법으로 진행해도 저는 좋을 것 같아서 질문 남깁니다. 외에 admin 관련 테스트가 아닌 부분에서의 개행은 수정이 필요할 것 같아 rc로 남겨두었습니다.
모두 개행 관련 피드백이라 편하게 보시고 수정하시면 될 것 같습니다!

import java.time.LocalDate;

public record CreateGoalRequest(
@NotEmpty(message = "이름이 입력되지 않았습니다.")
Copy link
Member

Choose a reason for hiding this comment

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

개행해주면 좋을 것 같습니다!

Copy link
Member Author

Choose a reason for hiding this comment

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

해당 부분은 record로 클래스 시작 부분이 아닌 파라미터입니다..!
해당 부분에서도 개행이 필요한 걸까요?

Copy link
Member

Choose a reason for hiding this comment

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

저는 개행을 해주었는데 딱히 개행이 필요하지 않을까요?

import jakarta.validation.constraints.NotEmpty;

public record CreateUserRequest(
@NotEmpty(message = "사용자 이름을 입력되지 않았습니다.")
Copy link
Member

Choose a reason for hiding this comment

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

개행해주면 좋을 것 같습니다!

import jakarta.validation.constraints.Positive;

public record RequestFriendRequest(
@NotEmpty(message = "친구 요청자가 입력되지 않았습니다.")
Copy link
Member

Choose a reason for hiding this comment

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

개행해주면 좋을 것 같습니다.

import jakarta.validation.constraints.Positive;

public record UpdateFriendRequest(
@NotEmpty(message = "친구 요청자가 입력되지 않았습니다.")
Copy link
Member

Choose a reason for hiding this comment

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

개행해주면 좋을 것 같습니다.

Comment on lines 7 to 8


Copy link
Member

Choose a reason for hiding this comment

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

개행이 두줄 들어간 것 같네요!


@Autowired
private AdminPageService adminPageService;
@Autowired
Copy link
Member

Choose a reason for hiding this comment

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

개행해주면 좋을 것 같습니다.

import com.backend.blooming.friend.application.exception.NotFoundFriendRequestException;
import com.backend.blooming.friend.domain.Friend;
import com.backend.blooming.friend.infrastructure.repository.FriendRepository;
import com.backend.blooming.notification.domain.Notification;
import com.backend.blooming.notification.infrastructure.repository.NotificationRepository;
import com.backend.blooming.user.application.exception.NotFoundUserException;
import org.assertj.core.api.SoftAssertions;
import org.assertj.core.api.*;
Copy link
Member

Choose a reason for hiding this comment

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

와일드카드가 보이네요!

Comment on lines 183 to 190
fieldWithPath("friends.[].friend.email").type(JsonFieldType.STRING)
.description("사용자 이메일"),
fieldWithPath("friends.[].friend.name").type(JsonFieldType.STRING)
.description("사용자 이름"),
fieldWithPath("friends.[].friend.color").type(JsonFieldType.STRING)
.description("사용자 테마 색상"),
fieldWithPath("friends.[].friend.statusMessage").type(JsonFieldType.STRING)
.description("사용자 상태 메시지"),
Copy link
Member

Choose a reason for hiding this comment

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

restDocs 부분 개행하지 않기로 했던 걸로 기억합니다!

Comment on lines 236 to 243
fieldWithPath("friends.[].friend.email").type(JsonFieldType.STRING)
.description("사용자 이메일"),
fieldWithPath("friends.[].friend.name").type(JsonFieldType.STRING)
.description("사용자 이름"),
fieldWithPath("friends.[].friend.color").type(JsonFieldType.STRING)
.description("사용자 테마 색상"),
fieldWithPath("friends.[].friend.statusMessage").type(JsonFieldType.STRING)
.description("사용자 상태 메시지"),
Copy link
Member

Choose a reason for hiding this comment

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

restDocs 부분 개행하지 않기로 했던 걸로 기억합니다!

Comment on lines 289 to 296
fieldWithPath("friends.[].friend.email").type(JsonFieldType.STRING)
.description("사용자 이메일"),
fieldWithPath("friends.[].friend.name").type(JsonFieldType.STRING)
.description("사용자 이름"),
fieldWithPath("friends.[].friend.color").type(JsonFieldType.STRING)
.description("사용자 테마 색상"),
fieldWithPath("friends.[].friend.statusMessage").type(JsonFieldType.STRING)
.description("사용자 상태 메시지"),
Copy link
Member

Choose a reason for hiding this comment

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

restDocs 부분 개행하지 않기로 했던 걸로 기억합니다!

@JJ503
Copy link
Member Author

JJ503 commented Feb 8, 2024

이미 테스트는 작성했기에 굳이 삭제하지는 않곘습니다!
다만, 현재처럼 간단한 테스트만 진행하는 것으로 하겠습니다.
리뷰해 주신 부분들에 대해 코멘트 작성 및 반영 진행 완료했습니다.

Copy link

sonarqubecloud bot commented Feb 8, 2024

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

25 New issues
0 Security Hotspots
97.4% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Member

@jhsseonn jhsseonn left a comment

Choose a reason for hiding this comment

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

컨벤션 적용 모두 확인했습니다! 개행 관련해서는 저는 개행을 해주었는데, record의 경우 파라미터 선언부라 개행이 딱히 필요하지 않다면 개행하지 않는 것으로 해요! 수정이 꼭 필요한 부분은 완료되어서 우선 approve 해두겠습니다.

@JJ503 JJ503 merged commit 39ff581 into develop Feb 8, 2024
2 checks passed
@JJ503 JJ503 deleted the feature/50 branch February 8, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 기능 추가
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feat] dev 서버용 관리자 테스트 페이지 추가
2 participants