Skip to content

Commit 6de69a1

Browse files
committed
test : utils test code add
1 parent 14f8f6b commit 6de69a1

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package org.benchmarker.bmcontroller.template.common;
2+
3+
import org.junit.jupiter.api.DisplayName;
4+
import org.junit.jupiter.api.Test;
5+
import org.springframework.boot.test.context.SpringBootTest;
6+
7+
import java.time.LocalDate;
8+
import java.time.LocalDateTime;
9+
import java.time.LocalTime;
10+
11+
import static org.assertj.core.api.Assertions.assertThat;
12+
import static org.junit.jupiter.api.Assertions.*;
13+
14+
@SpringBootTest
15+
class TemplateUtilsTest {
16+
17+
@Test
18+
@DisplayName("agent 에서 받은 시간 정확하게 Convert 하는지 확인")
19+
void convertStringToLocalDateTime() {
20+
21+
// given
22+
String dateTimeString = "2024-03-30T15:25:27.410335250";
23+
24+
// when
25+
LocalDateTime localDateTime = TemplateUtils.convertStringToLocalDateTime(dateTimeString);
26+
27+
// then
28+
assertThat(localDateTime).isEqualTo(LocalDateTime.of(LocalDate.parse("2024-03-30"), LocalTime.parse("15:25:27")));
29+
}
30+
31+
}

0 commit comments

Comments
 (0)