-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use zoned time on AuditingEntity
- Loading branch information
Showing
8 changed files
with
150 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...ring-boot/src/test/java/org/citrusframework/simulator/model/AbstractAuditingEntityIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.citrusframework.simulator.model; | ||
|
||
import org.assertj.core.data.TemporalUnitLessThanOffset; | ||
import org.citrusframework.simulator.common.TimeProvider; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static java.time.temporal.ChronoUnit.SECONDS; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class AbstractAuditingEntityIT { | ||
|
||
public static final TemporalUnitLessThanOffset LESS_THAN_1_SECOND = new TemporalUnitLessThanOffset(1, SECONDS); | ||
|
||
AuditedEntity fixture; | ||
|
||
@BeforeEach | ||
void setup() { | ||
fixture = new AuditedEntity(); | ||
} | ||
|
||
@Test | ||
void shouldUseCorrectTime() { | ||
var timeProvider = new TimeProvider(); | ||
assertThat(fixture.getCreatedDate()).isCloseTo(timeProvider.getTimeNow(), LESS_THAN_1_SECOND); | ||
assertThat(fixture.getLastModifiedDate()).isCloseTo(timeProvider.getTimeNow(), LESS_THAN_1_SECOND); | ||
} | ||
|
||
private static class AuditedEntity extends AbstractAuditingEntity<AuditedEntity, Long> { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters