We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 89f9bed commit 1d8ac6cCopy full SHA for 1d8ac6c
src/main/kotlin/queue/QueueTest.kt
@@ -0,0 +1,23 @@
1
+package queue
2
+
3
+import org.junit.jupiter.api.Assertions.assertEquals
4
+import org.junit.jupiter.api.Test
5
+import swaydb.java.memory.QueueConfig
6
+import swaydb.java.serializers.Default
7
+import java.time.Duration
8
9
+internal class QueueTest {
10
+ @Test
11
+ fun quickStart() {
12
+ val queue =
13
+ QueueConfig.config(Default.intSerializer())
14
+ .get()
15
16
+ queue.push(1)
17
+ queue.push(2, Duration.ofSeconds(0))
18
+ queue.push(3)
19
20
+ assertEquals(1, queue.popOrNull()) //1
21
+ assertEquals(3, queue.popOrNull()) //returns 3 because 2 is expired.
22
+ }
23
+}
0 commit comments