Skip to content

Commit

Permalink
Java 2387 (eugenp#9882)
Browse files Browse the repository at this point in the history
* fix junit test cases

* added module in parent build
  • Loading branch information
amit2103 authored Aug 17, 2020
1 parent f0a7b81 commit a4b4197
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public void givenALocalDate_whenFormattingWithPattern_thenPass() {
public void givenALocalDate_whenFormattingWithStyleAndLocale_thenPass() {
String result = subject.formatWithStyleAndLocale(localDateTime, FormatStyle.MEDIUM, Locale.UK);

assertThat(result).isEqualTo("25 Jan 2015, 06:30:00");
assertThat(result).isEqualTo("25-Jan-2015 06:30:00");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
Expand All @@ -24,10 +25,11 @@ public void givenAGregorianCalenderDate_whenConvertingToLocalDate_thenAsExpected

@Test
public void givenADate_whenConvertingToLocalDate_thenAsExpected() {
Date givenDate = new Date(1465817690000L);
LocalDateTime currentDateTime = LocalDateTime.now();
Date givenDate = Date.from(currentDateTime.atZone(ZoneId.systemDefault()).toInstant());

LocalDateTime localDateTime = subject.convertDateToLocalDate(givenDate);

assertThat(localDateTime).isEqualTo("2016-06-13T13:34:50");
assertThat(localDateTime).isEqualTo(currentDateTime);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void givenLocalDateOrZoned_whenSettingStartOfDay_thenReturnMidnightInAllC
@Test
public void givenAStringWithTimeZone_whenParsing_thenEqualsExpected() {
ZonedDateTime resultFromString = zonedDateTime.getZonedDateTimeUsingParseMethod("2015-05-03T10:15:30+01:00[Europe/Paris]");
ZonedDateTime resultFromLocalDateTime = ZonedDateTime.of(2015, 5, 3, 11, 15, 30, 0, ZoneId.of("Europe/Paris"));
ZonedDateTime resultFromLocalDateTime = ZonedDateTime.of(2015, 5, 3, 10, 15, 30, 0, ZoneId.of("Europe/Paris"));

assertThat(resultFromString.getZone()).isEqualTo(ZoneId.of("Europe/Paris"));
assertThat(resultFromLocalDateTime.getZone()).isEqualTo(ZoneId.of("Europe/Paris"));
Expand Down
1 change: 1 addition & 0 deletions core-java-modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<module>core-java-date-operations-2</module>
<!-- We haven't upgraded to java 9. -->
<!-- <module>core-java-datetime-computations</module> <module>core-java-datetime-conversion</module> <module>core-java-datetime-java8</module> <module>core-java-datetime-string</module> -->
<module>core-java-8-datetime</module>

<module>core-java-exceptions</module>
<module>core-java-exceptions-2</module>
Expand Down

0 comments on commit a4b4197

Please sign in to comment.