Skip to content

Commit

Permalink
release: 0.1.0
Browse files Browse the repository at this point in the history
release: 0.1.0
  • Loading branch information
devxb authored Jan 15, 2024
2 parents 7ec3188 + b97f496 commit 7802643
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/main/java/net/teumteum/user/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.teumteum.user.domain.response.FriendsResponse;
import net.teumteum.user.domain.response.InterestQuestionResponse;
import net.teumteum.user.domain.response.UserGetResponse;
import net.teumteum.user.domain.response.UserMeGetResponse;
import net.teumteum.user.domain.response.UserRegisterResponse;
import net.teumteum.user.domain.response.UsersGetByIdResponse;
import org.springframework.stereotype.Service;
Expand All @@ -35,6 +36,10 @@ public UserGetResponse getUserById(Long userId) {
return UserGetResponse.of(existUser);
}

public UserMeGetResponse getMe(Long userId) {
return UserMeGetResponse.of(getUser(userId));
}

public UsersGetByIdResponse getUsersById(List<Long> userIds) {
var existUsers = userRepository.findAllById(userIds);

Expand Down
35 changes: 30 additions & 5 deletions src/test/java/net/teumteum/integration/UserIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

import static org.assertj.core.api.Assertions.assertThatCode;

import java.util.List;
import net.teumteum.core.error.ErrorResponse;
import net.teumteum.user.domain.User;
import net.teumteum.user.domain.response.FriendsResponse;
import net.teumteum.user.domain.response.UserGetResponse;
import net.teumteum.user.domain.response.UserRegisterResponse;
import net.teumteum.user.domain.response.UsersGetByIdResponse;
import net.teumteum.user.domain.response.UserMeGetResponse;
import net.teumteum.user.domain.response.*;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;

import java.util.List;

@DisplayName("유저 통합테스트의")
class UserIntegrationTest extends IntegrationTest {

Expand Down Expand Up @@ -108,6 +107,32 @@ void Return_400_bad_request_if_empty_user_ids_input() {
}
}

@Nested
@DisplayName("내 정보 조회 API는")
class Find_my_info_api {

@Test
@DisplayName("유효한 토큰이 주어지면, 내 정보를 응답한다.")
void Return_my_info_if_valid_token_received() {
// given
var me = repository.saveAndGetUser();
loginContext.setUserId(me.getId());

var expected = UserMeGetResponse.of(me);

// when
var result = api.getUser(VALID_TOKEN, me.getId());

// then
Assertions.assertThat(result.expectStatus().isOk()
.expectBody(UserMeGetResponse.class)
.returnResult()
.getResponseBody())
.usingRecursiveComparison().isEqualTo(expected);
}

}

@Nested
@DisplayName("유저 수정 API는")
class Update_user_api {
Expand Down

0 comments on commit 7802643

Please sign in to comment.