Skip to content

Commit

Permalink
Using Instant in test
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-krecan-lt committed Apr 12, 2020
1 parent 1d3a1a0 commit c6727f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.time.Instant;

import static net.javacrumbs.shedlock.provider.dynamodb.DynamoDBLockProvider.ID;
import static net.javacrumbs.shedlock.provider.dynamodb.DynamoDBLockProvider.LOCKED_AT;
Expand Down Expand Up @@ -82,8 +81,8 @@ protected void assertUnlocked(String lockName) {
assertThat(lockItem.getString(LOCKED_BY)).isNotEmpty();
}

private OffsetDateTime now() {
return OffsetDateTime.now();
private Instant now() {
return Instant.now();
}

@Override
Expand All @@ -94,8 +93,8 @@ protected void assertLocked(String lockName) {
assertThat(lockItem.getString(LOCKED_BY)).isNotEmpty();
}

private OffsetDateTime fromIsoString(String isoString) {
return OffsetDateTime.parse(isoString, DateTimeFormatter.ISO_DATE_TIME);
private Instant fromIsoString(String isoString) {
return Instant.parse(isoString);
}

private Table getLockTable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
import software.amazon.awssdk.services.dynamodb.model.TableStatus;

import java.net.URI;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.time.Instant;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -118,8 +117,8 @@ protected void assertUnlocked(String lockName) {
assertThat(lockItem.get(LOCKED_BY).s()).isNotEmpty();
}

private OffsetDateTime now() {
return OffsetDateTime.now();
private Instant now() {
return Instant.now();
}

@Override
Expand All @@ -130,8 +129,8 @@ protected void assertLocked(String lockName) {
assertThat(lockItem.get(LOCKED_BY).s()).isNotEmpty();
}

private OffsetDateTime fromIsoString(String isoString) {
return OffsetDateTime.parse(isoString, DateTimeFormatter.ISO_DATE_TIME);
private Instant fromIsoString(String isoString) {
return Instant.parse(isoString);
}

private Map<String, AttributeValue> getLockItem(String lockName) {
Expand Down

0 comments on commit c6727f0

Please sign in to comment.