본문 바로가기

개발 일지

[TIL] 사이드 프로젝트 28일차

 

1. 개발 진행 상황

테스트 코드 작성

채팅 기능 공부

 

2. 개발 중 발생한 이슈와 해결

1) 상황

- 테스트 코드를 각 기능(회원, 게시글, 모임, 댓글 등등 )을 테스트하면 테스트를 성공하지만 모든 코드를 한번에 테스트하면 테스트 실패

 

2) 원인

- 회원, 게시글, 댓글 등등 각 테스트를 위해 임의로 작성한 데이터가 중복되거나 제약조건이 위반되어서 에러 발생

 

3) 해결 방법

 

1. 제일 간단한 MypageController 테스트 로그를 확인을 해봄

    @BeforeEach
    public void setup(RestDocumentationContextProvider restDocumentationContextProvider) throws Exception {

        mockMvc = MockMvcBuilders
                .webAppContextSetup(webApplicationContext)
                .addFilters(new CharacterEncodingFilter("UTF-8", true))
                .apply(springSecurity())
                .apply(documentationConfiguration(restDocumentationContextProvider)
                        .operationPreprocessors()
                        .withRequestDefaults(modifyUris().host("tommy.me").removePort(), prettyPrint())
                        .withResponseDefaults(modifyUris().host("tommy.me").removePort(), prettyPrint()))
                .alwaysDo(print())
                .build();

        Member member = Member.builder()
                .id(1L)
                .nickname(USERNAME)
                .password(PASSWORD)
                .email(USERNAME)
                .image("test-image")
                .userRole(ROLE_MEMBER)
                .build();
        memberRepository.save(member);
        getAccessToken();
        userDetails = (UserDetailsImpl) testUserDetailsService.loadUserByUsername(USERNAME);
    }

    @Test
    @DisplayName("내 정보 조회 - 정상응답")
    public void getMyProfileTest() throws Exception {
        // When & Then
        this.mockMvc.perform(MockMvcRequestBuilders.get("/api/mypage")
                        .header("Authorization", getAccessToken())
                        .contentType(APPLICATION_JSON)
                        .accept(HAL_JSON))
                .andExpect(status().isOk())
                .andDo(document("get-MyProfile",
                                requestHeaders(
                                        headerWithName(HttpHeaders.ACCEPT).description("accept header"),
                                        headerWithName(HttpHeaders.AUTHORIZATION).description("access token"),
                                        headerWithName(HttpHeaders.CONTENT_TYPE).description("content type")
                                ),
                                responseHeaders(
                                        headerWithName(HttpHeaders.CONTENT_TYPE).description("content type")
                                ),
                                responseFields(
                                        fieldWithPath("status").description("status of action"),
                                        fieldWithPath("message").description("message of action"),
                                        fieldWithPath("data.id").description("id of member"),
                                        fieldWithPath("data.nickname").description("nickname of member"),
                                        fieldWithPath("data.email").description("email of member"),
                                        fieldWithPath("data.image").description("image of member"),
                                        fieldWithPath("data.links[0].rel").description("relation"),
                                        fieldWithPath("data.links[0].href").description("url of action")
                                )
                        )
                )
        ;

        // Then
        assertThat(userDetails.getMember().getId()).isEqualTo(1L);
        assertThat(userDetails.getMember().getNickname()).isEqualTo(USERNAME);
        assertThat(userDetails.getMember().getEmail()).isEqualTo(USERNAME);
        assertThat(userDetails.getMember().getImage()).isEqualTo("test-image");
    }

 

// 테이블 생성 부분 생략

Hibernate: 
// id default로 생성 되는거라 select하지 않게 코드에서 삭제 필요
    select
        member0_.id as id1_3_0_, 
        member0_.email as email2_3_0_,
        member0_.image as image3_3_0_,
        member0_.nickname as nickname4_3_0_,
        member0_.password as password5_3_0_,
        member0_.user_role as user_rol6_3_0_ 
    from
        member member0_ 
    where
        member0_.id=?
2022-12-13 17:09:35.922 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [1]
Hibernate: 
// 회원 정보 생성 및 저장
    insert 
    into
        member
        (id, email, image, nickname, password, user_role) 
    values
        (default, ?, ?, ?, ?, ?)
2022-12-13 17:09:36.007 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [VARCHAR] - [user@example.com]
2022-12-13 17:09:36.008 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [2] as [VARCHAR] - [test-image]
2022-12-13 17:09:36.008 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [3] as [VARCHAR] - [user@example.com]
2022-12-13 17:09:36.009 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [4] as [VARCHAR] - [password]
2022-12-13 17:09:36.009 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [5] as [VARCHAR] - [ROLE_MEMBER]
Hibernate: 
// 저장된 회원 정보를 통해 회원을 db에서 찾아서 인증
    select
        member0_.id as id1_3_,
        member0_.email as email2_3_,
        member0_.image as image3_3_,
        member0_.nickname as nickname4_3_,
        member0_.password as password5_3_,
        member0_.user_role as user_rol6_3_ 
    from
        member member0_ 
    where
        member0_.email=?
2022-12-13 17:09:36.226 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [VARCHAR] - [user@example.com]
2022-12-13 17:09:36.228 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([id1_3_] : [BIGINT]) - [1]
2022-12-13 17:09:36.232 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([email2_3_] : [VARCHAR]) - [user@example.com]
2022-12-13 17:09:36.233 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([image3_3_] : [VARCHAR]) - [test-image]
2022-12-13 17:09:36.234 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([nickname4_3_] : [VARCHAR]) - [user@example.com]
2022-12-13 17:09:36.234 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([password5_3_] : [VARCHAR]) - [password]
2022-12-13 17:09:36.235 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([user_rol6_3_] : [VARCHAR]) - [ROLE_MEMBER]
Hibernate: 
// 로그인하여 토큰 얻음
    select
        refreshtok0_.id as id1_5_,
        refreshtok0_.key_value as key_valu2_5_,
        refreshtok0_.member_id as member_i3_5_ 
    from
        refresh_token refreshtok0_ 
    where
        refreshtok0_.member_id=?
2022-12-13 17:09:36.257 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [1]
Hibernate: 
    select
        refreshtok0_.id as id1_5_0_,
        refreshtok0_.key_value as key_valu2_5_0_,
        refreshtok0_.member_id as member_i3_5_0_ 
    from
        refresh_token refreshtok0_ 
    where
        refreshtok0_.id=?
2022-12-13 17:09:36.326 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [VARCHAR] - [user@example.com]
Hibernate: 
    insert 
    into
        refresh_token
        (key_value, member_id, id) 
    values
        (?, ?, ?)
2022-12-13 17:09:36.348 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [VARCHAR] - [eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzE1MjM3NzZ9.iYdfw5KaQY5lStevrKXviIWHe4TDtscKnbn7G9pwa-k]
2022-12-13 17:09:36.349 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [2] as [BIGINT] - [1]
2022-12-13 17:09:36.349 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [3] as [VARCHAR] - [user@example.com]

MockHttpServletRequest:
      HTTP Method = POST
      Request URI = /api/member/login
       Parameters = {}
          Headers = [Content-Type:"application/json;charset=UTF-8", Accept:"application/hal+json", Content-Length:"50"]
             Body = {"email":"user@example.com","password":"password"}
    Session Attrs = {}

Handler:
             Type = sideproject.petmeeting.member.controller.MemberController
           Method = sideproject.petmeeting.member.controller.MemberController#login(LoginRequestDto, Errors, HttpServletResponse)

Async:
    Async started = false
     Async result = null

Resolved Exception:
             Type = null

ModelAndView:
        View name = null
             View = null
            Model = null

FlashMap:
       Attributes = null

MockHttpServletResponse:
           Status = 200
    Error message = null
          Headers = [Vary:"Origin", "Access-Control-Request-Method", "Access-Control-Request-Headers", Authorization:"Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyQGV4YW1wbGUuY29tIiwiYXV0aCI6IlJPTEVfTUVNQkVSIiwiZXhwIjoxNjcwOTI5Nzc2fQ.Gc0YQISM8NvGb_4nzr_Nx9GIHQOOv7rYyvk9PjAlvdE", RefreshToken:"eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzE1MjM3NzZ9.iYdfw5KaQY5lStevrKXviIWHe4TDtscKnbn7G9pwa-k", Content-Type:"application/json;charset=UTF-8", X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0"]
     Content type = application/json;charset=UTF-8
             Body = {"status":"OK","message":"로그인에 성공하였습니다.","data":{"object":"user@example.com","links":[{"rel":"self","href":"http://localhost:8080/api/member"}]}}
    Forwarded URL = null
   Redirected URL = null
          Cookies = []

MockHttpServletRequest:
      HTTP Method = POST
      Request URI = /api/member/login
       Parameters = {}
          Headers = [Content-Type:"application/json;charset=UTF-8", Accept:"application/hal+json", Content-Length:"50"]
             Body = {"email":"user@example.com","password":"password"}
    Session Attrs = {}

Handler:
             Type = sideproject.petmeeting.member.controller.MemberController
           Method = sideproject.petmeeting.member.controller.MemberController#login(LoginRequestDto, Errors, HttpServletResponse)

Async:
    Async started = false
     Async result = null

Resolved Exception:
             Type = null

ModelAndView:
        View name = null
             View = null
            Model = null

FlashMap:
       Attributes = null

MockHttpServletResponse:
           Status = 200
    Error message = null
          Headers = [Vary:"Origin", "Access-Control-Request-Method", "Access-Control-Request-Headers", Authorization:"Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyQGV4YW1wbGUuY29tIiwiYXV0aCI6IlJPTEVfTUVNQkVSIiwiZXhwIjoxNjcwOTI5Nzc2fQ.Gc0YQISM8NvGb_4nzr_Nx9GIHQOOv7rYyvk9PjAlvdE", RefreshToken:"eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzE1MjM3NzZ9.iYdfw5KaQY5lStevrKXviIWHe4TDtscKnbn7G9pwa-k", Content-Type:"application/json;charset=UTF-8", X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0"]
     Content type = application/json;charset=UTF-8
             Body = {"status":"OK","message":"로그인에 성공하였습니다.","data":{"object":"user@example.com","links":[{"rel":"self","href":"http://localhost:8080/api/member"}]}}
    Forwarded URL = null
   Redirected URL = null
          Cookies = []
Hibernate: 
    select
        refreshtok0_.id as id1_5_,
        refreshtok0_.key_value as key_valu2_5_,
        refreshtok0_.member_id as member_i3_5_ 
    from
        refresh_token refreshtok0_
2022-12-13 17:09:36.485 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([id1_5_] : [VARCHAR]) - [user@example.com]
2022-12-13 17:09:36.485 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([key_valu2_5_] : [VARCHAR]) - [eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzE1MjM3NzZ9.iYdfw5KaQY5lStevrKXviIWHe4TDtscKnbn7G9pwa-k]
2022-12-13 17:09:36.485 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([member_i3_5_] : [BIGINT]) - [1]
Hibernate: 
    select
        member0_.id as id1_3_,
        member0_.email as email2_3_,
        member0_.image as image3_3_,
        member0_.nickname as nickname4_3_,
        member0_.password as password5_3_,
        member0_.user_role as user_rol6_3_ 
    from
        member member0_ 
    where
        member0_.email=?
2022-12-13 17:09:36.627 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [VARCHAR] - [user@example.com]
2022-12-13 17:09:36.628 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([id1_3_] : [BIGINT]) - [1]
2022-12-13 17:09:36.629 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([email2_3_] : [VARCHAR]) - [user@example.com]
2022-12-13 17:09:36.629 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([image3_3_] : [VARCHAR]) - [test-image]
2022-12-13 17:09:36.630 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([nickname4_3_] : [VARCHAR]) - [user@example.com]
2022-12-13 17:09:36.630 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([password5_3_] : [VARCHAR]) - [password]
2022-12-13 17:09:36.630 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([user_rol6_3_] : [VARCHAR]) - [ROLE_MEMBER]
Hibernate: 
    select
        refreshtok0_.id as id1_5_,
        refreshtok0_.key_value as key_valu2_5_,
        refreshtok0_.member_id as member_i3_5_ 
    from
        refresh_token refreshtok0_ 
    where
        refreshtok0_.member_id=?
2022-12-13 17:09:36.633 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [1]
2022-12-13 17:09:36.634 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([id1_5_] : [VARCHAR]) - [user@example.com]
2022-12-13 17:09:36.635 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([key_valu2_5_] : [VARCHAR]) - [eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzE1MjM3NzZ9.iYdfw5KaQY5lStevrKXviIWHe4TDtscKnbn7G9pwa-k]
2022-12-13 17:09:36.635 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([member_i3_5_] : [BIGINT]) - [1]
Hibernate: 
    delete 
    from
        refresh_token 
    where
        id=?
2022-12-13 17:09:36.648 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [VARCHAR] - [user@example.com]
Hibernate: 
    insert 
    into
        refresh_token
        (key_value, member_id, id) 
    values
        (?, ?, ?)
2022-12-13 17:09:36.653 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [VARCHAR] - [eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzE1MjM3NzZ9.iYdfw5KaQY5lStevrKXviIWHe4TDtscKnbn7G9pwa-k]
2022-12-13 17:09:36.654 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [2] as [BIGINT] - [1]
2022-12-13 17:09:36.654 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [3] as [VARCHAR] - [user@example.com]

MockHttpServletRequest:
      HTTP Method = POST
      Request URI = /api/member/login
       Parameters = {}
          Headers = [Content-Type:"application/json;charset=UTF-8", Accept:"application/hal+json", Content-Length:"50"]
             Body = {"email":"user@example.com","password":"password"}
    Session Attrs = {}

Handler:
             Type = sideproject.petmeeting.member.controller.MemberController
           Method = sideproject.petmeeting.member.controller.MemberController#login(LoginRequestDto, Errors, HttpServletResponse)

Async:
    Async started = false
     Async result = null

Resolved Exception:
             Type = null

ModelAndView:
        View name = null
             View = null
            Model = null

FlashMap:
       Attributes = null

MockHttpServletResponse:
           Status = 200
    Error message = null
          Headers = [Vary:"Origin", "Access-Control-Request-Method", "Access-Control-Request-Headers", Authorization:"Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyQGV4YW1wbGUuY29tIiwiYXV0aCI6IlJPTEVfTUVNQkVSIiwiZXhwIjoxNjcwOTI5Nzc2fQ.Gc0YQISM8NvGb_4nzr_Nx9GIHQOOv7rYyvk9PjAlvdE", RefreshToken:"eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzE1MjM3NzZ9.iYdfw5KaQY5lStevrKXviIWHe4TDtscKnbn7G9pwa-k", Content-Type:"application/json;charset=UTF-8", X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0"]
     Content type = application/json;charset=UTF-8
             Body = {"status":"OK","message":"로그인에 성공하였습니다.","data":{"object":"user@example.com","links":[{"rel":"self","href":"http://localhost:8080/api/member"}]}}
    Forwarded URL = null
   Redirected URL = null
          Cookies = []

MockHttpServletRequest:
      HTTP Method = POST
      Request URI = /api/member/login
       Parameters = {}
          Headers = [Content-Type:"application/json;charset=UTF-8", Accept:"application/hal+json", Content-Length:"50"]
             Body = {"email":"user@example.com","password":"password"}
    Session Attrs = {}

Handler:
             Type = sideproject.petmeeting.member.controller.MemberController
           Method = sideproject.petmeeting.member.controller.MemberController#login(LoginRequestDto, Errors, HttpServletResponse)

Async:
    Async started = false
     Async result = null

Resolved Exception:
             Type = null

ModelAndView:
        View name = null
             View = null
            Model = null

FlashMap:
       Attributes = null

MockHttpServletResponse:
           Status = 200
    Error message = null
          Headers = [Vary:"Origin", "Access-Control-Request-Method", "Access-Control-Request-Headers", Authorization:"Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyQGV4YW1wbGUuY29tIiwiYXV0aCI6IlJPTEVfTUVNQkVSIiwiZXhwIjoxNjcwOTI5Nzc2fQ.Gc0YQISM8NvGb_4nzr_Nx9GIHQOOv7rYyvk9PjAlvdE", RefreshToken:"eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzE1MjM3NzZ9.iYdfw5KaQY5lStevrKXviIWHe4TDtscKnbn7G9pwa-k", Content-Type:"application/json;charset=UTF-8", X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0"]
     Content type = application/json;charset=UTF-8
             Body = {"status":"OK","message":"로그인에 성공하였습니다.","data":{"object":"user@example.com","links":[{"rel":"self","href":"http://localhost:8080/api/member"}]}}
    Forwarded URL = null
   Redirected URL = null
          Cookies = []
Hibernate: 
    select
        refreshtok0_.id as id1_5_,
        refreshtok0_.key_value as key_valu2_5_,
        refreshtok0_.member_id as member_i3_5_ 
    from
        refresh_token refreshtok0_
2022-12-13 17:09:36.665 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([id1_5_] : [VARCHAR]) - [user@example.com]
2022-12-13 17:09:36.665 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([key_valu2_5_] : [VARCHAR]) - [eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzE1MjM3NzZ9.iYdfw5KaQY5lStevrKXviIWHe4TDtscKnbn7G9pwa-k]
2022-12-13 17:09:36.666 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([member_i3_5_] : [BIGINT]) - [1]
Hibernate: 
    select
        member0_.id as id1_3_,
        member0_.email as email2_3_,
        member0_.image as image3_3_,
        member0_.nickname as nickname4_3_,
        member0_.password as password5_3_,
        member0_.user_role as user_rol6_3_ 
    from
        member member0_ 
    where
        member0_.email=?
2022-12-13 17:09:36.746 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [VARCHAR] - [user@example.com]
2022-12-13 17:09:36.747 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([id1_3_] : [BIGINT]) - [1]
2022-12-13 17:09:36.747 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([email2_3_] : [VARCHAR]) - [user@example.com]
2022-12-13 17:09:36.747 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([image3_3_] : [VARCHAR]) - [test-image]
2022-12-13 17:09:36.747 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([nickname4_3_] : [VARCHAR]) - [user@example.com]
2022-12-13 17:09:36.747 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([password5_3_] : [VARCHAR]) - [password]
2022-12-13 17:09:36.747 TRACE 10346 --- [    Test worker] o.h.type.descriptor.sql.BasicExtractor   : extracted value ([user_rol6_3_] : [VARCHAR]) - [ROLE_MEMBER]

MockHttpServletRequest:
      HTTP Method = GET
      Request URI = /api/mypage
       Parameters = {}
          Headers = [Content-Type:"application/json;charset=UTF-8", Authorization:"Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyQGV4YW1wbGUuY29tIiwiYXV0aCI6IlJPTEVfTUVNQkVSIiwiZXhwIjoxNjcwOTI5Nzc2fQ.Gc0YQISM8NvGb_4nzr_Nx9GIHQOOv7rYyvk9PjAlvdE", Accept:"application/hal+json"]
             Body = null
    Session Attrs = {}

Handler:
             Type = sideproject.petmeeting.myPage.controller.MyPageController
           Method = sideproject.petmeeting.myPage.controller.MyPageController#getMyProfile(UserDetailsImpl)

Async:
    Async started = false
     Async result = null

Resolved Exception:
             Type = null

ModelAndView:
        View name = null
             View = null
            Model = null

FlashMap:
       Attributes = null

MockHttpServletResponse:
           Status = 200
    Error message = null
          Headers = [Vary:"Origin", "Access-Control-Request-Method", "Access-Control-Request-Headers", Content-Type:"application/hal+json;charset=UTF-8", X-Content-Type-Options:"nosniff", X-XSS-Protection:"1; mode=block", Cache-Control:"no-cache, no-store, max-age=0, must-revalidate", Pragma:"no-cache", Expires:"0"]
     Content type = application/hal+json;charset=UTF-8
             Body = {"status":"OK","message":"내 프로필 조회 성공","data":{"id":1,"nickname":"user@example.com","email":"user@example.com","image":"test-image","links":[{"rel":"self","href":"http://localhost:8080/api/mypage"},{"rel":"member-edit","href":"http://localhost:8080/api/member"}]}}
    Forwarded URL = null
   Redirected URL = null
          Cookies = []
2022-12-13 17:09:37.378  INFO 10346 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2022-12-13 17:09:37.384  INFO 10346 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2022-12-13 17:09:37.394  INFO 10346 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 26s
5 actionable tasks: 1 executed, 4 up-to-date
5:09:37 PM: Execution finished ':test --tests "sideproject.petmeeting.myPage.controller.MyPageControllerTest.getMyProfileTest"'.

 

왜 id가 default? member 도메인에서 설정해놓은 것 때문에??

 

3. 새로 배운 것

테스트 에러 발생 해결을 위해서 로그에서 쿼리 value값 확인하기, 쿼리가 두번 찍히는 문제 해결