Skip to content

Commit 3e32ced

Browse files
author
Wagner Dias
committed
Add samples for chronoZonedDateTimeExpectations of api-fluent (robstoll#916)
1 parent 4d7f539 commit 3e32ced

File tree

1 file changed

+150
-0
lines changed

1 file changed

+150
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
package ch.tutteli.atrium.api.fluent.en_GB.samples
2+
3+
import ch.tutteli.atrium.api.fluent.en_GB.*
4+
import ch.tutteli.atrium.api.verbs.internal.expect
5+
import java.time.ZoneId
6+
import java.time.ZonedDateTime
7+
import kotlin.test.Test
8+
9+
class ChronoZonedDateTimeExpectationSamples {
10+
11+
@Test
12+
fun toBeBeforeChronoZonedDateTime() {
13+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
14+
.toBeBefore(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")))
15+
}
16+
17+
@Test
18+
fun toBeBeforeString() {
19+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
20+
.toBeBefore("2021-06-06T12:10:00.000000000-03:00")
21+
22+
// format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part
23+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
24+
.toBeBefore("2021-06-06T12:10:00-03:00")
25+
26+
// format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part
27+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
28+
.toBeBefore("2021-06-06T12:10-03:00")
29+
30+
// format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part
31+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
32+
.toBeBefore("2021-06-07-03:00")
33+
}
34+
35+
@Test
36+
fun toBeBeforeOrTheSamePointInTimeAsChronoZonedDateTime() {
37+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
38+
.toBeBeforeOrTheSamePointInTimeAs(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")))
39+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
40+
.toBeBeforeOrTheSamePointInTimeAs(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
41+
}
42+
43+
@Test
44+
fun toBeBeforeOrTheSamePointInTimeAsString() {
45+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
46+
.toBeBeforeOrTheSamePointInTimeAs("2021-06-06T12:10:00.000000000-03:00")
47+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
48+
.toBeBeforeOrTheSamePointInTimeAs("2021-06-06T10:05:35.000000103-03:00")
49+
50+
// format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part
51+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 34, 0, ZoneId.of("America/Sao_Paulo")))
52+
.toBeBeforeOrTheSamePointInTimeAs("2021-06-06T12:10:00-03:00")
53+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 0, ZoneId.of("America/Sao_Paulo")))
54+
.toBeBeforeOrTheSamePointInTimeAs("2021-06-06T10:05:35-03:00")
55+
56+
// format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part
57+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
58+
.toBeBeforeOrTheSamePointInTimeAs("2021-06-06T12:10-03:00")
59+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 0, 0, ZoneId.of("America/Sao_Paulo")))
60+
.toBeBeforeOrTheSamePointInTimeAs("2021-06-06T10:05-03:00")
61+
62+
// format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part
63+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
64+
.toBeBeforeOrTheSamePointInTimeAs("2021-06-07-03:00")
65+
expect(ZonedDateTime.of(2021, 6, 6, 0, 0, 0, 0, ZoneId.of("America/Sao_Paulo")))
66+
.toBeBeforeOrTheSamePointInTimeAs("2021-06-06-03:00")
67+
}
68+
69+
@Test
70+
fun toBeTheSamePointInTimeAsChronoZonedDateTime() {
71+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
72+
.toBeTheSamePointInTimeAs(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
73+
}
74+
75+
@Test
76+
fun toBeTheSamePointInTimeAsString() {
77+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
78+
.toBeTheSamePointInTimeAs("2021-06-06T10:05:35.000000103-03:00")
79+
80+
// format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part
81+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 0, ZoneId.of("America/Sao_Paulo")))
82+
.toBeTheSamePointInTimeAs("2021-06-06T10:05:35-03:00")
83+
84+
// format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part
85+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 0, 0, ZoneId.of("America/Sao_Paulo")))
86+
.toBeTheSamePointInTimeAs("2021-06-06T10:05-03:00")
87+
88+
// format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part
89+
expect(ZonedDateTime.of(2021, 6, 6, 0, 0, 0, 0, ZoneId.of("America/Sao_Paulo")))
90+
.toBeTheSamePointInTimeAs("2021-06-06-03:00")
91+
}
92+
93+
@Test
94+
fun toBeAfterOrTheSamePointInTimeAsChronoZonedDateTime() {
95+
expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")))
96+
.toBeAfterOrTheSamePointInTimeAs(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
97+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
98+
.toBeAfterOrTheSamePointInTimeAs(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
99+
}
100+
101+
@Test
102+
fun toBeAfterOrTheSamePointInTimeAsString() {
103+
expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")))
104+
.toBeAfterOrTheSamePointInTimeAs("2021-06-06T10:05:35.000000103-03:00")
105+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
106+
.toBeAfterOrTheSamePointInTimeAs("2021-06-06T10:05:35.000000103-03:00")
107+
108+
// format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part
109+
expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")))
110+
.toBeAfterOrTheSamePointInTimeAs("2021-06-06T10:05:35-03:00")
111+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 0, ZoneId.of("America/Sao_Paulo")))
112+
.toBeAfterOrTheSamePointInTimeAs("2021-06-06T10:05:35-03:00")
113+
114+
// format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part
115+
expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")))
116+
.toBeAfterOrTheSamePointInTimeAs("2021-06-06T10:05-03:00")
117+
expect(ZonedDateTime.of(2021, 6, 6, 10, 5, 0, 0, ZoneId.of("America/Sao_Paulo")))
118+
.toBeAfterOrTheSamePointInTimeAs("2021-06-06T10:05-03:00")
119+
120+
// format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part
121+
expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")))
122+
.toBeAfterOrTheSamePointInTimeAs("2021-06-06-03:00")
123+
expect(ZonedDateTime.of(2021, 6, 6, 0, 0, 0, 0, ZoneId.of("America/Sao_Paulo")))
124+
.toBeAfterOrTheSamePointInTimeAs("2021-06-06-03:00")
125+
}
126+
127+
@Test
128+
fun toBeAfterChronoZonedDateTime() {
129+
expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")))
130+
.toBeAfter(ZonedDateTime.of(2021, 6, 6, 10, 5, 35, 103, ZoneId.of("America/Sao_Paulo")))
131+
}
132+
133+
@Test
134+
fun toBeAfterString() {
135+
expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")))
136+
.toBeAfter("2021-06-06T10:05:35.103000000-03:00")
137+
138+
// format yyyy-MM-ddThh:mm:SS can be used, in which case .000000000 is used for the omitted part
139+
expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")))
140+
.toBeAfter("2021-06-06T10:05:35-03:00")
141+
142+
// format yyyy-MM-ddThh:mm can be used, in which case 00.000000000 is used for the omitted part
143+
expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")))
144+
.toBeAfter("2021-06-06T10:05-03:00")
145+
146+
// format yyyy-MM-dd can be used, in which case 00:00:00.000000000 is used for the omitted part
147+
expect(ZonedDateTime.of(2021, 6, 6, 12, 10, 0, 0, ZoneId.of("America/Sao_Paulo")))
148+
.toBeAfter("2021-06-06-03:00")
149+
}
150+
}

0 commit comments

Comments
 (0)