[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: Clock manipulation.
From: |
gnunet |
Subject: |
[libeufin] branch master updated: Clock manipulation. |
Date: |
Tue, 05 Jan 2021 20:41:00 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new 0066707 Clock manipulation.
0066707 is described below
commit 00667074eaa9218dc9a2d7eaf102f2360c6a8505
Author: MS <ms@taler.net>
AuthorDate: Tue Jan 5 20:39:13 2021 +0100
Clock manipulation.
Trying to move clock in the future along a unit test.
---
util/src/test/kotlin/TimeTest.kt | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/util/src/test/kotlin/TimeTest.kt b/util/src/test/kotlin/TimeTest.kt
index d22127b..872fe6a 100644
--- a/util/src/test/kotlin/TimeTest.kt
+++ b/util/src/test/kotlin/TimeTest.kt
@@ -1,10 +1,22 @@
import org.junit.Test
-import tech.libeufin.util.parseDashedDate
import java.time.*
import java.time.format.DateTimeFormatter
-import java.time.temporal.TemporalAccessor
+
+//
https://stackoverflow.com/questions/32437550/whats-the-difference-between-instant-and-localdatetime
class TimeTest {
+ @Test
+ fun mock() {
+ // Using the system clock, thus not mocking at all.
+ val systemClock = Clock.system(ZoneId.systemDefault())
+ val realNow = ZonedDateTime.now(systemClock)
+ println(realNow)
+ // Moving four hours later.
+ val offsetTime = Clock.offset(systemClock, Duration.ofHours(4))
+ val offesetNow = ZonedDateTime.now(offsetTime)
+ println(offesetNow)
+ }
+
@Test
fun importMillis() {
fun fromLong(millis: Long): LocalDateTime {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: Clock manipulation.,
gnunet <=