All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmTest.io.islandtime.jvm.JavaSanityTest Maven / Gradle / Ivy

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