Skip to content

Commit

Permalink
imports added after applying review suggestions, naming conventions f…
Browse files Browse the repository at this point in the history
…or tests
  • Loading branch information
dragonfly28 committed Nov 4, 2024
1 parent 270fb0c commit eefcc74
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import de.muenchen.oss.wahllokalsystem.monitoringservice.service.waehleranzahl.WaehleranzahlModel;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.ZoneId;
import lombok.val;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import de.muenchen.oss.wahllokalsystem.monitoringservice.service.waehleranzahl.WaehleranzahlModel;
import de.muenchen.oss.wahllokalsystem.wls.common.security.domain.BezirkUndWahlID;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import lombok.val;
import org.assertj.core.api.Assertions;
Expand All @@ -19,7 +21,7 @@ public class WaehleranzahlClientMapperTest {
class FromModelToRemoteClientDTO {

@Test
void isMappedWithSomething() {
void should_return_RemoteClientDTO_when_modelIsGiven() {
val wahlID = "wahlID01";
val wahlbezirkID = "wahlbezirkID01";
val anzahlWahler = 99L;
Expand All @@ -31,38 +33,35 @@ void isMappedWithSomething() {

val result = unitUnderTest.fromModelToRemoteClientDTO(waehleranzahlModel);

val zoneOffset = ZoneId.systemDefault().getRules().getOffset(meldeZeitpunkt);
val expectedWahlbeteiligungsMeldungDTO = new WahlbeteiligungsMeldungDTO().wahlID(null).wahlbezirkID(wahlbezirkID).anzahlWaehler(anzahlWahler)
.meldeZeitpunkt(meldeZeitpunkt.atOffset(ZoneOffset.UTC));
.meldeZeitpunkt(meldeZeitpunkt.atOffset(zoneOffset));
Assertions.assertThat(result).isEqualTo(expectedWahlbeteiligungsMeldungDTO);
}
}

@Nested
class LocalDateTimeToOffsetDateTime {

@Nested
class WithZoneIdWithDaylightSavingTime {

@Test
void should_useSummerSeasonOffset_when_mapping() {
val localDateTime = LocalDateTime.parse("2024-06-12T12:13:14.567");
val zoneID = ZoneId.of("Europe/Berlin");
@Test
void should_useSummerSeasonOffset_when_mapping() {
val localDateTime = LocalDateTime.parse("2024-06-12T12:13:14.567");
val zoneID = ZoneId.of("Europe/Berlin");

val result = unitUnderTest.localDateTimeToOffsetDateTime(localDateTime, zoneID);
val result = unitUnderTest.localDateTimeToOffsetDateTime(localDateTime, zoneID);

val expectedResult = OffsetDateTime.of(localDateTime, ZoneOffset.ofHours(2));
Assertions.assertThat(result).isEqualTo(expectedResult);
}
val expectedResult = OffsetDateTime.of(localDateTime, ZoneOffset.ofHours(2));
Assertions.assertThat(result).isEqualTo(expectedResult);
}

@Test
void should_useWinterSeasonOffset_when_mapping() {
val localDateTime = LocalDateTime.parse("2024-11-12T12:13:14.567");
val zoneID = ZoneId.of("Europe/Berlin");
val result = unitUnderTest.localDateTimeToOffsetDateTime(localDateTime, zoneID);
@Test
void should_useWinterSeasonOffset_when_mapping() {
val localDateTime = LocalDateTime.parse("2024-11-12T12:13:14.567");
val zoneID = ZoneId.of("Europe/Berlin");
val result = unitUnderTest.localDateTimeToOffsetDateTime(localDateTime, zoneID);

val expectedResult = OffsetDateTime.of(localDateTime, ZoneOffset.ofHours(1));
Assertions.assertThat(result).isEqualTo(expectedResult);
}
val expectedResult = OffsetDateTime.of(localDateTime, ZoneOffset.ofHours(1));
Assertions.assertThat(result).isEqualTo(expectedResult);
}
}
}

0 comments on commit eefcc74

Please sign in to comment.