This repository has been archived by the owner on Apr 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TimeTest.java
99 lines (92 loc) · 2.51 KB
/
TimeTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package org.acme.endpoints.time;
import io.quarkus.test.common.http.TestHTTPEndpoint;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import java.net.HttpURLConnection;
import org.acme.endpoints.Time;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
@QuarkusTest
@TestHTTPEndpoint(Time.class)
public class TimeTest {
@Test
public void base_path_is_always_the_same() {
RestAssured
.get()
.then()
.statusCode(HttpURLConnection.HTTP_OK)
.assertThat()
.body(
"withoutTimezoneField",
Matchers.is("2022-12-18T19:39:20"),
"withTimezoneField",
Matchers.is("2022-12-18T19:39:20+01:00"),
"withTimezoneGmt2Field",
Matchers.is("2022-12-18T17:39:20Z")
);
}
@Test
public void getting_as_instants() {
RestAssured
.get("/instants")
.then()
.statusCode(HttpURLConnection.HTTP_OK)
.assertThat()
.body(
"withoutTimezoneField",
Matchers.is("2022-12-18T19:39:20Z"),
"withTimezoneField",
Matchers.is("2022-12-18T18:39:20Z"),
"withTimezoneGmt2Field",
Matchers.is("2022-12-18T17:39:20Z")
);
}
@Test
public void getting_as_local_date_time() {
RestAssured
.get("/localdatetimes")
.then()
.statusCode(HttpURLConnection.HTTP_OK)
.assertThat()
.body(
"withoutTimezoneField",
Matchers.is("2022-12-18T20:39:20"),
"withTimezoneField",
Matchers.is("2022-12-18T19:39:20"),
"withTimezoneGmt2Field",
Matchers.is("2022-12-18T18:39:20")
);
}
@Test
public void getting_as_offset_date_time() {
RestAssured
.get("/offsetdatetimes")
.then()
.statusCode(HttpURLConnection.HTTP_OK)
.assertThat()
.body(
"withoutTimezoneField",
Matchers.is("2022-12-18T20:39:20+01:00"),
"withTimezoneField",
Matchers.is("2022-12-18T19:39:20+01:00"),
"withTimezoneGmt2Field",
Matchers.is("2022-12-18T18:39:20+01:00")
);
}
@Test
public void getting_as_zoned_date_time() {
RestAssured
.get("/zoneddatetimes")
.then()
.statusCode(HttpURLConnection.HTTP_OK)
.assertThat()
.body(
"withoutTimezoneField",
Matchers.is("2022-12-18T20:39:20+01:00[Etc/GMT-1]"),
"withTimezoneField",
Matchers.is("2022-12-18T19:39:20+01:00[Etc/GMT-1]"),
"withTimezoneGmt2Field",
Matchers.is("2022-12-18T18:39:20+01:00[Etc/GMT-1]")
);
}
}