Skip to content

Commit

Permalink
test: 상태코드 추가에 의한 test코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
kimsongmok committed Nov 13, 2024
1 parent 739c1d6 commit af9f44b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/test/java/com/splanet/splanet/log/service/LogServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ void setUp() throws IOException {
String deviceId = "apiTestDeviceId";
String requestPath = "/test/api";
String headers = "User-Agent: ApiTestAgent, Accept: application/json";
int statusCode = 200;

// when
logService.recordApiRequestLog(userId, deviceId, requestPath, headers);
logService.recordApiRequestLog(userId, deviceId, requestPath, headers, statusCode);

// then
File logFile = new File(logPath);
Expand All @@ -75,7 +76,14 @@ void setUp() throws IOException {
// 로그 파일 내용 확인
try {
String content = Files.readString(logFile.toPath());
assertThat(content).contains("eventType: API_REQUEST", "userId: 2", "deviceId: apiTestDeviceId", "requestPath: /test/api", "headers: User-Agent: ApiTestAgent, Accept: application/json");
assertThat(content).contains(
"eventType: API_REQUEST",
"userId: 2",
"deviceId: apiTestDeviceId",
"requestPath: /test/api",
"headers: User-Agent: ApiTestAgent, Accept: application/json",
"statusCode: 200"
);
} catch (IOException e) {
e.printStackTrace();
}
Expand Down

0 comments on commit af9f44b

Please sign in to comment.