jvmTest.io.islandtime.jvm.JavaSanityTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core-metadata Show documentation
Show all versions of core-metadata Show documentation
A multiplatform library for working with dates and times
The newest version!
package io.islandtime.jvm;
import io.islandtime.Date;
import io.islandtime.Month;
import org.junit.Test;
import java.time.LocalDate;
import static com.google.common.truth.Truth.assertThat;
import static io.islandtime.jvm.IslandTimeUtils.*;
public class JavaSanityTest {
@Test
public void convertIslandDateToJavaLocalDate() {
Date islandDate = new Date(2019, Month.MARCH, 1);
LocalDate javaDate = toJavaLocalDate(islandDate);
assertThat(javaDate.getYear()).isEqualTo(islandDate.getYear());
assertThat(javaDate.getMonthValue()).isEqualTo(islandDate.getMonth().getNumber());
assertThat(javaDate.getDayOfMonth()).isEqualTo(islandDate.getDayOfMonth());
}
@Test
public void convertJavaLocalDateToIslandDate() {
LocalDate javaDate = LocalDate.of(2019, 3, 1);
Date islandDate = toIslandDate(javaDate);
assertThat(islandDate.getYear()).isEqualTo(javaDate.getYear());
assertThat(islandDate.getMonth().getNumber()).isEqualTo(javaDate.getMonthValue());
assertThat(islandDate.getDayOfMonth()).isEqualTo(javaDate.getDayOfMonth());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy