@@ -35,33 +35,36 @@ public void zoneId() {
35
35
var ids = ZoneId .getAvailableZoneIds (); // all available timezone ids
36
36
37
37
ZoneId zone1 = ZoneId .of ("Europe/Berlin" );
38
- ZoneId zone2 = ZoneId .of ("Brazil/East " );
38
+ ZoneId zone2 = ZoneId .of ("Europe/London " );
39
39
var zoneRules1 = zone1 .getRules (); // ZoneRules[currentStandardOffset=+01:00]
40
- var zoneRules2 = zone2 .getRules (); // ZoneRules[currentStandardOffset=-03 :00]
40
+ var zoneRules2 = zone2 .getRules (); // ZoneRules[currentStandardOffset=00 :00]
41
41
}
42
42
43
43
@ Test
44
44
public void localTime () {
45
45
ZoneId zone1 = ZoneId .of ("Europe/Berlin" );
46
- ZoneId zone2 = ZoneId .of ("Brazil/East " );
46
+ ZoneId zone2 = ZoneId .of ("Europe/London " );
47
47
48
48
LocalTime now1 = LocalTime .now (zone1 );
49
49
LocalTime now2 = LocalTime .now (zone2 );
50
50
51
51
var isNow1BeforeNow2 = now1 .isBefore (now2 );
52
52
assertThat (isNow1BeforeNow2 ).isFalse ();
53
53
54
- long hoursBetween = ChronoUnit .HOURS .between (now1 , now2 ); //4
54
+ long hoursBetween = ChronoUnit .HOURS .between (now1 , now2 );
55
55
long minutesBetween = ChronoUnit .MINUTES .between (now1 , now2 );
56
- assertThat (minutesBetween ).isEqualTo (-299 );
56
+ System .out .println (hoursBetween + " " + minutesBetween );
57
+ assertThat (minutesBetween ).isEqualTo (-59L );
57
58
58
- LocalTime late = LocalTime .of (23 , 59 , 59 ); // 23:59:59
59
+ LocalTime late = LocalTime .of (23 , 59 , 59 );
60
+ assertThat (String .valueOf (late )).isEqualTo ("23:59:59" );
59
61
60
62
DateTimeFormatter germanFormatter = DateTimeFormatter
61
63
.ofLocalizedTime (FormatStyle .SHORT )
62
64
.withLocale (Locale .GERMAN );
63
65
64
- LocalTime germanTime = LocalTime .parse ("13:37" , germanFormatter ); // 13:37
66
+ LocalTime germanTime = LocalTime .parse ("13:37" , germanFormatter );
67
+ assertThat (String .valueOf (germanTime )).isEqualTo ("13:37" );
65
68
}
66
69
67
70
@ Test
@@ -80,7 +83,8 @@ public void localDate() {
80
83
.ofLocalizedDate (FormatStyle .MEDIUM )
81
84
.withLocale (Locale .GERMAN );
82
85
83
- LocalDate xmas = LocalDate .parse ("24.12.2014" , germanFormatter ); // 2014-12-24
86
+ LocalDate xmas = LocalDate .parse ("24.12.2014" , germanFormatter );
87
+ assertThat (String .valueOf (xmas )).isEqualTo ("2014-12-24" );
84
88
}
85
89
86
90
@ Test
0 commit comments