Search in sources :

Example 81 with LocalTime

use of org.joda.time.LocalTime in project mapstruct by mapstruct.

the class JodaConversionTest method testStringToLocalTime.

@ProcessorTest
public void testStringToLocalTime() {
    String dateTimeAsString = "00:00";
    Target target = new Target();
    target.setLocalTime(dateTimeAsString);
    LocalTime sourceTime = new LocalTime(0, 0);
    Source src = SourceTargetMapper.INSTANCE.targetToSourceLocalTimeMapped(target);
    assertThat(src).isNotNull();
    assertThat(src.getLocalTime()).isEqualTo(sourceTime);
}
Also used : LocalTime(org.joda.time.LocalTime) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 82 with LocalTime

use of org.joda.time.LocalTime in project mapstruct by mapstruct.

the class JodaConversionTest method testLocalTimeToString.

@ProcessorTest
public void testLocalTimeToString() {
    Source src = new Source();
    src.setLocalTime(new LocalTime(0, 0));
    Target target = SourceTargetMapper.INSTANCE.sourceToTargetLocalTimeMapped(src);
    assertThat(target).isNotNull();
    assertThat(target.getLocalTime()).isEqualTo("00:00");
}
Also used : LocalTime(org.joda.time.LocalTime) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 83 with LocalTime

use of org.joda.time.LocalTime in project mapstruct by mapstruct.

the class JodaConversionTest method testTargetToSourceMappingForStrings.

@ProcessorTest
public void testTargetToSourceMappingForStrings() {
    Target target = new Target();
    target.setDateTime("01.01.2014 00:00 UTC");
    target.setLocalDateTime("01.01.2014 00:00");
    target.setLocalDate("01.01.2014");
    target.setLocalTime("00:00");
    Source src = SourceTargetMapper.INSTANCE.targetToSource(target);
    assertThat(src.getDateTime()).isEqualTo(new DateTime(2014, 1, 1, 0, 0, DateTimeZone.UTC));
    assertThat(src.getLocalDateTime()).isEqualTo(new LocalDateTime(2014, 1, 1, 0, 0));
    assertThat(src.getLocalDate()).isEqualTo(new LocalDate(2014, 1, 1));
    assertThat(src.getLocalTime()).isEqualTo(new LocalTime(0, 0));
}
Also used : LocalDateTime(org.joda.time.LocalDateTime) LocalTime(org.joda.time.LocalTime) LocalDate(org.joda.time.LocalDate) DateTime(org.joda.time.DateTime) LocalDateTime(org.joda.time.LocalDateTime) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Aggregations

LocalTime (org.joda.time.LocalTime)83 Test (org.junit.Test)34 OpeningHours (io.jawg.osmcontributor.model.utils.OpeningHours)17 LocalDate (org.joda.time.LocalDate)16 DateTime (org.joda.time.DateTime)15 LocalDateTime (org.joda.time.LocalDateTime)15 Date (java.util.Date)12 DateTimeZone (org.joda.time.DateTimeZone)10 OpeningMonth (io.jawg.osmcontributor.model.utils.OpeningMonth)6 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)6 Test (org.testng.annotations.Test)6 ArrayList (java.util.ArrayList)5 OpeningTime (io.jawg.osmcontributor.model.utils.OpeningTime)4 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)3 ContentValues (android.content.ContentValues)2 Time (java.sql.Time)2 EntityManager (javax.persistence.EntityManager)2 EntityTransaction (javax.persistence.EntityTransaction)2 JodaSample3 (org.datanucleus.samples.types.jodatime.JodaSample3)2 DatePickerDialog (android.app.DatePickerDialog)1