Skip to content

Commit

Permalink
Suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan202 committed Nov 1, 2022
1 parent 413ef61 commit bbd1efb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ZoneOffset after() {
}
}

static final class InstantToLocalDate {
static final class LocalDateOfInstant {
@BeforeTemplate
LocalDate before(Instant instant, ZoneId zoneId) {
return Refaster.anyOf(
Expand All @@ -86,7 +86,7 @@ LocalDate after(Instant instant, ZoneId zoneId) {
}
}

static final class InstantToLocalDateTime {
static final class LocalDateTimeOfInstant {
@BeforeTemplate
LocalDateTime before(Instant instant, ZoneId zoneId) {
return Refaster.anyOf(
Expand All @@ -105,7 +105,7 @@ LocalDateTime after(Instant instant, ZoneId zoneId) {
}
}

static final class InstantToLocalTime {
static final class LocalTimeOfInstant {
@BeforeTemplate
LocalTime before(Instant instant, ZoneId zoneId) {
return Refaster.anyOf(
Expand All @@ -126,7 +126,7 @@ LocalTime after(Instant instant, ZoneId zoneId) {
}

/** Prefer {@link Instant#atOffset(ZoneOffset)} over the more verbose alternative. */
static final class InstantToOffsetDateTime {
static final class InstantAtOffset {
@BeforeTemplate
OffsetDateTime before(Instant instant, ZoneOffset zoneOffset) {
return OffsetDateTime.ofInstant(instant, zoneOffset);
Expand All @@ -138,7 +138,7 @@ OffsetDateTime after(Instant instant, ZoneOffset zoneOffset) {
}
}

static final class InstantToOffsetTime {
static final class OffsetTimeOfInstant {
@BeforeTemplate
OffsetTime before(Instant instant, ZoneId zoneId) {
return instant.atZone(zoneId).toOffsetDateTime().toOffsetTime();
Expand All @@ -156,7 +156,7 @@ OffsetTime after(Instant instant, ZoneId zoneId) {
}

/** Prefer {@link Instant#atZone(ZoneId)} over the more verbose alternative. */
static final class InstantToZonedDateTime {
static final class InstantAtZone {
@BeforeTemplate
ZonedDateTime before(Instant instant, ZoneId zoneId) {
return ZonedDateTime.ofInstant(instant, zoneId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,40 +36,40 @@ ImmutableSet<ZoneId> testUtcConstant() {
ZoneId.from(ZoneOffset.UTC));
}

ImmutableSet<LocalDate> testInstantToLocalDate() {
ImmutableSet<LocalDate> testLocalDateOfInstant() {
return ImmutableSet.of(
Instant.EPOCH.atZone(ZoneId.of("Europe/Amsterdam")).toLocalDate(),
Instant.EPOCH.atZone(ZoneId.of("Europe/Paris")).toOffsetDateTime().toLocalDate(),
Instant.EPOCH.atOffset(ZoneOffset.UTC).toLocalDate(),
LocalDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")).toLocalDate());
}

ImmutableSet<LocalDateTime> testInstantToLocalDateTime() {
ImmutableSet<LocalDateTime> testLocalDateTimeOfInstant() {
return ImmutableSet.of(
Instant.EPOCH.atZone(ZoneId.of("Europe/Amsterdam")).toLocalDateTime(),
Instant.EPOCH.atZone(ZoneId.of("Europe/Berlin")).toOffsetDateTime().toLocalDateTime(),
Instant.EPOCH.atOffset(ZoneOffset.UTC).toLocalDateTime());
}

ImmutableSet<LocalTime> testInstantToLocalTime() {
ImmutableSet<LocalTime> testLocalTimeOfInstant() {
return ImmutableSet.of(
Instant.EPOCH.atZone(ZoneId.of("Europe/Amsterdam")).toLocalTime(),
Instant.EPOCH.atZone(ZoneId.of("Europe/Paris")).toOffsetDateTime().toLocalTime(),
Instant.EPOCH.atOffset(ZoneOffset.UTC).toLocalTime(),
LocalDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")).toLocalTime());
}

OffsetDateTime testInstantToOffsetDateTime() {
OffsetDateTime testInstantAtOffset() {
return OffsetDateTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC);
}

ImmutableSet<OffsetTime> testInstantToOffsetTime() {
ImmutableSet<OffsetTime> testOffsetTimeOfInstant() {
return ImmutableSet.of(
Instant.EPOCH.atZone(ZoneId.of("Europe/Amsterdam")).toOffsetDateTime().toOffsetTime(),
Instant.EPOCH.atOffset(ZoneOffset.UTC).toOffsetTime());
}

ZonedDateTime testInstantToZonedDateTime() {
ZonedDateTime testInstantAtZone() {
return ZonedDateTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,40 +36,40 @@ ImmutableSet<ZoneId> testUtcConstant() {
ZoneOffset.UTC);
}

ImmutableSet<LocalDate> testInstantToLocalDate() {
ImmutableSet<LocalDate> testLocalDateOfInstant() {
return ImmutableSet.of(
LocalDate.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Amsterdam")),
LocalDate.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Paris")),
LocalDate.ofInstant(Instant.EPOCH, ZoneOffset.UTC),
LocalDate.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")));
}

ImmutableSet<LocalDateTime> testInstantToLocalDateTime() {
ImmutableSet<LocalDateTime> testLocalDateTimeOfInstant() {
return ImmutableSet.of(
LocalDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Amsterdam")),
LocalDateTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")),
LocalDateTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC));
}

ImmutableSet<LocalTime> testInstantToLocalTime() {
ImmutableSet<LocalTime> testLocalTimeOfInstant() {
return ImmutableSet.of(
LocalTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Amsterdam")),
LocalTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Paris")),
LocalTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC),
LocalTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Berlin")));
}

OffsetDateTime testInstantToOffsetDateTime() {
OffsetDateTime testInstantAtOffset() {
return Instant.EPOCH.atOffset(ZoneOffset.UTC);
}

ImmutableSet<OffsetTime> testInstantToOffsetTime() {
ImmutableSet<OffsetTime> testOffsetTimeOfInstant() {
return ImmutableSet.of(
OffsetTime.ofInstant(Instant.EPOCH, ZoneId.of("Europe/Amsterdam")),
OffsetTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC));
}

ZonedDateTime testInstantToZonedDateTime() {
ZonedDateTime testInstantAtZone() {
return Instant.EPOCH.atZone(ZoneOffset.UTC);
}

Expand Down

0 comments on commit bbd1efb

Please sign in to comment.