From 65e7886168ed12a1beec860c7601af9ceed17679 Mon Sep 17 00:00:00 2001 From: Florian Friemel Date: Fri, 8 Mar 2019 15:15:40 +0000 Subject: [PATCH] Fix flaky test. (#4851) --- .../net/corda/node/services/vault/VaultQueryTests.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt b/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt index 29d10e9a16..09d6f7e39b 100644 --- a/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt +++ b/node/src/test/kotlin/net/corda/node/services/vault/VaultQueryTests.kt @@ -47,6 +47,7 @@ import org.junit.Test import org.junit.rules.ExpectedException import org.junit.rules.ExternalResource import java.time.Duration +import java.time.Instant import java.time.LocalDate import java.time.ZoneOffset import java.time.temporal.ChronoUnit @@ -1609,7 +1610,12 @@ abstract class VaultQueryTestsBase : VaultQueryParties { println("$index : $any") } assertThat(results.otherResults.size).isEqualTo(402) - assertThat(results.otherResults.last()).isEqualTo(200L) + val instants = results.otherResults.filter { it is Instant }.map { it as Instant } + assertThat(instants).isSorted + val longs = results.otherResults.filter { it is Long }.map { it as Long } + assertThat(longs.size).isEqualTo(201) + assertThat(instants.size).isEqualTo(201) + assertThat(longs.sum()).isEqualTo(20100L) } }