-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tht server 199 유저의 오늘의 대화주제 선택여부 조회 api (#201)
* docs : 대화주제선택여부 api 문서화 * test : 대화주제 선택여부 인수테스트 * Feat : 유저의 오늘의 대화주제 선택여부 조회 api
- Loading branch information
Showing
8 changed files
with
254 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/com/tht/api/app/facade/main/response/DailyTopicChooseResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.tht.api.app.facade.main.response; | ||
|
||
public record DailyTopicChooseResponse( | ||
boolean isChoose | ||
) { | ||
|
||
public static DailyTopicChooseResponse isChooseDone() { | ||
return new DailyTopicChooseResponse(true); | ||
} | ||
|
||
public static DailyTopicChooseResponse isNotChoose() { | ||
return new DailyTopicChooseResponse(false); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/com/tht/api/exception/custom/DailyFallingException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.tht.api.exception.custom; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class DailyFallingException extends RuntimeException { | ||
|
||
public DailyFallingException(final String message) { | ||
super(message); | ||
} | ||
|
||
public static DailyFallingException notExist() { | ||
return new DailyFallingException("오늘의 폴링 주제어가 존재하지 않습니다."); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/test/java/com/tht/api/app/acceptance/DailyFallingAcceptanceStep.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.tht.api.app.acceptance; | ||
|
||
import io.restassured.RestAssured; | ||
import io.restassured.response.ExtractableResponse; | ||
import io.restassured.response.Response; | ||
import org.springframework.http.MediaType; | ||
|
||
public class DailyFallingAcceptanceStep { | ||
|
||
public static ExtractableResponse<Response> 그날의주제어_선택여부_조회_요청(String accessToken) { | ||
return RestAssured.given().log().all() | ||
.auth().oauth2(accessToken) | ||
.contentType(MediaType.APPLICATION_JSON_VALUE) | ||
.when() | ||
.get("/check/is-choose-daily-topic") | ||
.then().log().all() | ||
.extract(); | ||
} | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
src/test/java/com/tht/api/app/acceptance/DailyFallingAcceptanceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.tht.api.app.acceptance; | ||
|
||
import com.tht.api.app.acceptance.config.AcceptanceTest; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static com.tht.api.app.acceptance.DailyFallingAcceptanceStep.그날의주제어_선택여부_조회_요청; | ||
import static com.tht.api.app.acceptance.UserAcceptanceStep.그날의_대화토픽_선택_요청; | ||
import static com.tht.api.app.acceptance.UserAcceptanceStep.신규유저_생성_요청_후_토큰추출; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertAll; | ||
|
||
public class DailyFallingAcceptanceTest extends AcceptanceTest { | ||
|
||
@DisplayName("유저의 오늘의 토픽주제 선택여부 확인 - 미선택시 false") | ||
@Test | ||
public void isChooseDailyTopicFalse() { | ||
|
||
//give | ||
var 나 = 신규유저_생성_요청_후_토큰추출("일반 사용자1", "01065689787"); | ||
그날의주제어_생성_요청(); | ||
|
||
//when | ||
var response = 그날의주제어_선택여부_조회_요청(나); | ||
|
||
//then | ||
assertAll( | ||
() -> assertThat(response.statusCode()).isEqualTo(200), | ||
() -> assertThat(response.jsonPath().getBoolean("isChoose")).isFalse() | ||
|
||
); | ||
|
||
} | ||
|
||
@DisplayName("유저의 오늘의 토픽주제 선택여부 확인 - 선택시 true") | ||
@Test | ||
public void isChooseDailyTopicTrue() { | ||
|
||
//give | ||
var 나 = 신규유저_생성_요청_후_토큰추출("일반 사용자1", "01065689787"); | ||
var dailyFalling = 그날의주제어_생성_요청(); | ||
|
||
그날의_대화토픽_선택_요청(dailyFalling.getIdx(), 나); | ||
|
||
//when | ||
var response = 그날의주제어_선택여부_조회_요청(나); | ||
|
||
//then | ||
assertAll( | ||
() -> assertThat(response.statusCode()).isEqualTo(200), | ||
() -> assertThat(response.jsonPath().getBoolean("isChoose")).isTrue() | ||
|
||
); | ||
|
||
} | ||
} |
Oops, something went wrong.