diff --git a/client/jackson/src/test/kotlin/net/corda/client/jackson/StringToMethodCallParserTest.kt b/client/jackson/src/test/kotlin/net/corda/client/jackson/StringToMethodCallParserTest.kt
index 88444c3255..7fcd8259f0 100644
--- a/client/jackson/src/test/kotlin/net/corda/client/jackson/StringToMethodCallParserTest.kt
+++ b/client/jackson/src/test/kotlin/net/corda/client/jackson/StringToMethodCallParserTest.kt
@@ -51,7 +51,6 @@ class StringToMethodCallParserTest {
val result = parser.parse(Target(), "complexNestedObject pairs: { first: 101, second: [ A, B, C ] }").invoke()
assertTrue(result is Pair<*,*>)
- result as Pair<*,*>
assertEquals(101, result.first)
diff --git a/client/rpc/src/test/kotlin/net/corda/client/rpc/Measure.kt b/client/rpc/src/test/kotlin/net/corda/client/rpc/Measure.kt
index 1e288f2741..c970becbce 100644
--- a/client/rpc/src/test/kotlin/net/corda/client/rpc/Measure.kt
+++ b/client/rpc/src/test/kotlin/net/corda/client/rpc/Measure.kt
@@ -2,6 +2,7 @@ package net.corda.client.rpc
import net.corda.core.internal.uncheckedCast
import kotlin.reflect.KCallable
+import kotlin.reflect.jvm.ExperimentalReflectionOnLambdas
import kotlin.reflect.jvm.reflect
/**
@@ -10,15 +11,19 @@ import kotlin.reflect.jvm.reflect
* different combinations of parameters.
*/
+@OptIn(ExperimentalReflectionOnLambdas::class)
fun measure(a: Iterable, f: (A) -> R) =
measure(listOf(a), f.reflect()!!) { f(uncheckedCast(it[0])) }
+@OptIn(ExperimentalReflectionOnLambdas::class)
fun measure(a: Iterable, b: Iterable, f: (A, B) -> R) =
measure(listOf(a, b), f.reflect()!!) { f(uncheckedCast(it[0]), uncheckedCast(it[1])) }
+@OptIn(ExperimentalReflectionOnLambdas::class)
fun measure(a: Iterable, b: Iterable, c: Iterable, f: (A, B, C) -> R) =
measure(listOf(a, b, c), f.reflect()!!) { f(uncheckedCast(it[0]), uncheckedCast(it[1]), uncheckedCast(it[2])) }
+@OptIn(ExperimentalReflectionOnLambdas::class)
fun measure(a: Iterable, b: Iterable, c: Iterable, d: Iterable, f: (A, B, C, D) -> R) =
measure(listOf(a, b, c, d), f.reflect()!!) { f(uncheckedCast(it[0]), uncheckedCast(it[1]), uncheckedCast(it[2]), uncheckedCast(it[3])) }
diff --git a/core-tests/src/test/kotlin/net/corda/coretests/flows/FastThreadLocalTest.kt b/core-tests/src/test/kotlin/net/corda/coretests/flows/FastThreadLocalTest.kt
index f029492750..8dd320f48b 100644
--- a/core-tests/src/test/kotlin/net/corda/coretests/flows/FastThreadLocalTest.kt
+++ b/core-tests/src/test/kotlin/net/corda/coretests/flows/FastThreadLocalTest.kt
@@ -13,7 +13,7 @@ import net.corda.core.internal.rootCause
import net.corda.core.utilities.getOrThrow
import org.assertj.core.api.Assertions.catchThrowable
import org.hamcrest.Matchers.lessThanOrEqualTo
-import org.junit.Assert.assertThat
+import org.hamcrest.MatcherAssert.assertThat
import org.junit.Test
import java.util.*
import java.util.concurrent.ExecutorService
diff --git a/core-tests/src/test/kotlin/net/corda/coretests/flows/ReceiveAllFlowTests.kt b/core-tests/src/test/kotlin/net/corda/coretests/flows/ReceiveAllFlowTests.kt
index f450beb377..7006a5e8a5 100644
--- a/core-tests/src/test/kotlin/net/corda/coretests/flows/ReceiveAllFlowTests.kt
+++ b/core-tests/src/test/kotlin/net/corda/coretests/flows/ReceiveAllFlowTests.kt
@@ -58,7 +58,7 @@ class ReceiveMultipleFlowTests : WithMockNet {
assertEquals(message, receivedMessage)
session.send(answer)
}
- } as FlowLogic
+ }
}
assertThat(
diff --git a/core-tests/src/test/kotlin/net/corda/coretests/serialization/AttachmentSerializationTest.kt b/core-tests/src/test/kotlin/net/corda/coretests/serialization/AttachmentSerializationTest.kt
index 1fed709a98..b1735fdf8e 100644
--- a/core-tests/src/test/kotlin/net/corda/coretests/serialization/AttachmentSerializationTest.kt
+++ b/core-tests/src/test/kotlin/net/corda/coretests/serialization/AttachmentSerializationTest.kt
@@ -116,6 +116,7 @@ class AttachmentSerializationTest {
private class CustomAttachment(override val id: SecureHash, internal val customContent: String) : Attachment {
override fun open() = throw UnsupportedOperationException("Not implemented.")
override val signerKeys get() = throw UnsupportedOperationException()
+ @Suppress("OVERRIDE_DEPRECATION")
override val signers: List get() = throw UnsupportedOperationException()
override val size get() = throw UnsupportedOperationException()
}
diff --git a/core-tests/src/test/kotlin/net/corda/coretests/transactions/TransactionTests.kt b/core-tests/src/test/kotlin/net/corda/coretests/transactions/TransactionTests.kt
index 3818d6ac3e..b987af0440 100644
--- a/core-tests/src/test/kotlin/net/corda/coretests/transactions/TransactionTests.kt
+++ b/core-tests/src/test/kotlin/net/corda/coretests/transactions/TransactionTests.kt
@@ -205,7 +205,7 @@ class TransactionTests(private val digestService : DigestService) {
val attachments = listOf(ContractAttachment(object : AbstractAttachment({
(AttachmentsClassLoaderTests::class.java.getResource(ISOLATED_JAR) ?: fail("Missing $ISOLATED_JAR")).openStream().readBytes()
}, TESTDSL_UPLOADER) {
- @Suppress("OverridingDeprecatedMember")
+ @Suppress("OVERRIDE_DEPRECATION")
override val signers: List = emptyList()
override val signerKeys: List = emptyList()
override val size: Int = 1234
diff --git a/node/src/integration-test/kotlin/net/corda/node/flows/FlowOverrideTests.kt b/node/src/integration-test/kotlin/net/corda/node/flows/FlowOverrideTests.kt
index 5fb4afd3a4..21d948d632 100644
--- a/node/src/integration-test/kotlin/net/corda/node/flows/FlowOverrideTests.kt
+++ b/node/src/integration-test/kotlin/net/corda/node/flows/FlowOverrideTests.kt
@@ -15,7 +15,7 @@ import net.corda.testing.driver.NodeParameters
import net.corda.testing.driver.driver
import net.corda.testing.node.internal.cordappForClasses
import org.hamcrest.CoreMatchers.`is`
-import org.junit.Assert.assertThat
+import org.hamcrest.MatcherAssert.assertThat
import org.junit.Test
class FlowOverrideTests {
diff --git a/node/src/integration-test/kotlin/net/corda/node/services/CordaServiceIssueOnceAtStartupTests.kt b/node/src/integration-test/kotlin/net/corda/node/services/CordaServiceIssueOnceAtStartupTests.kt
index 2e27e36f05..3f19955c9a 100644
--- a/node/src/integration-test/kotlin/net/corda/node/services/CordaServiceIssueOnceAtStartupTests.kt
+++ b/node/src/integration-test/kotlin/net/corda/node/services/CordaServiceIssueOnceAtStartupTests.kt
@@ -29,6 +29,7 @@ import org.junit.Test
import java.io.File
import kotlin.test.assertEquals
import kotlin.test.assertTrue
+import kotlin.io.path.createTempFile
/**
* The idea of this test is upon start-up of the node check if cash been already issued and if not issue under certain reference.
@@ -40,7 +41,7 @@ class CordaServiceIssueOnceAtStartupTests {
private val armedPropName = this::class.java.enclosingClass.name + "-armed"
private val logger = contextLogger()
private val tempFilePropertyName = this::class.java.enclosingClass.name + "-tmpFile"
- private val tmpFile = createTempFile(prefix = tempFilePropertyName)
+ private val tmpFile = createTempFile(prefix = tempFilePropertyName).toFile()
private const val vaultQueryExecutedMarker = "VaultQueryExecuted"
private const val sentFlowMarker = "SentFlow"
}
diff --git a/node/src/integration-test/kotlin/net/corda/node/services/CordaServiceLifecycleFatalTests.kt b/node/src/integration-test/kotlin/net/corda/node/services/CordaServiceLifecycleFatalTests.kt
index 35c1352c7a..0cbca6894a 100644
--- a/node/src/integration-test/kotlin/net/corda/node/services/CordaServiceLifecycleFatalTests.kt
+++ b/node/src/integration-test/kotlin/net/corda/node/services/CordaServiceLifecycleFatalTests.kt
@@ -18,7 +18,7 @@ import org.junit.Test
import java.io.File
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
-
+import kotlin.io.path.createTempFile
class CordaServiceLifecycleFatalTests {
companion object {
@@ -34,7 +34,7 @@ class CordaServiceLifecycleFatalTests {
// Temporaty file used as a latch between two processes
private val tempFilePropertyName = this::class.java.enclosingClass.name + "-tmpFile"
- private val tmpFile = createTempFile(prefix = tempFilePropertyName)
+ private val tmpFile = createTempFile(prefix = tempFilePropertyName).toFile()
private const val readyToThrowMarker = "ReadyToThrow"
private const val goodToThrowMarker = "GoodToThrow"
diff --git a/node/src/main/kotlin/net/corda/node/internal/CordaRPCOpsImpl.kt b/node/src/main/kotlin/net/corda/node/internal/CordaRPCOpsImpl.kt
index 3612abbf2d..290e2e1b41 100644
--- a/node/src/main/kotlin/net/corda/node/internal/CordaRPCOpsImpl.kt
+++ b/node/src/main/kotlin/net/corda/node/internal/CordaRPCOpsImpl.kt
@@ -138,18 +138,18 @@ internal class CordaRPCOpsImpl(
return services.vaultService._trackBy(criteria, paging, sorting, contractStateType)
}
- @Suppress("OverridingDeprecatedMember", "DEPRECATION")
+ @Suppress("OVERRIDE_DEPRECATION", "OverridingDeprecatedMember", "DEPRECATION")
override fun internalVerifiedTransactionsSnapshot(): List {
val (snapshot, updates) = internalVerifiedTransactionsFeed()
updates.notUsed()
return snapshot
}
- @Suppress("OverridingDeprecatedMember")
+ @Suppress("OVERRIDE_DEPRECATION")
override fun internalFindVerifiedTransaction(txnId: SecureHash): SignedTransaction? =
services.validatedTransactions.getTransaction(txnId)
- @Suppress("OverridingDeprecatedMember")
+ @Suppress("OVERRIDE_DEPRECATION")
override fun internalVerifiedTransactionsFeed(): DataFeed, SignedTransaction> {
return services.validatedTransactions.track()
}
diff --git a/node/src/test/kotlin/net/corda/node/migration/IdentityServiceToStringShortMigrationTest.kt b/node/src/test/kotlin/net/corda/node/migration/IdentityServiceToStringShortMigrationTest.kt
index 0e095e95a1..3dd068dc8a 100644
--- a/node/src/test/kotlin/net/corda/node/migration/IdentityServiceToStringShortMigrationTest.kt
+++ b/node/src/test/kotlin/net/corda/node/migration/IdentityServiceToStringShortMigrationTest.kt
@@ -24,7 +24,6 @@ import org.hamcrest.Matchers.anyOf
import org.hamcrest.Matchers.`is`
import org.hamcrest.number.OrderingComparison.greaterThan
import org.junit.After
-import org.junit.Assert
import org.junit.Before
import org.junit.Test
@@ -103,9 +102,9 @@ class IdentityServiceToStringShortMigrationTest {
val hashToIdentityResultSet = hashToIdentityStatement.executeQuery()
//check that there is a row for every "new" hash
- Assert.assertThat(hashToIdentityResultSet.next(), `is`(true))
+ assertThat(hashToIdentityResultSet.next(), `is`(true))
//check that the pk_hash actually matches what we expect (kinda redundant, but deserializing the whole PartyAndCertificate feels like overkill)
- Assert.assertThat(hashToIdentityResultSet.getString(1), `is`(it.owningKey.toStringShort()))
+ assertThat(hashToIdentityResultSet.getString(1), `is`(it.owningKey.toStringShort()))
val nameToHashStatement = connection.prepareStatement("SELECT name FROM node_named_identities WHERE pk_hash=?")
nameToHashStatement.setString(1, it.owningKey.toStringShort())
@@ -113,7 +112,7 @@ class IdentityServiceToStringShortMigrationTest {
//if there is no result for this key, this means its an identity that is not stored in the DB (IE, it's been seen after another identity has already been mapped to it)
if (nameToHashResultSet.next()) {
- Assert.assertThat(nameToHashResultSet.getString(1), `is`(anyOf(groupedByNameIdentities.getValue(it.name).map?> { identity -> CoreMatchers.equalTo(identity.name.toString()) })))
+ assertThat(nameToHashResultSet.getString(1), `is`(anyOf(groupedByNameIdentities.getValue(it.name).map?> { identity -> CoreMatchers.equalTo(identity.name.toString()) })))
} else {
logger.warn("did not find a PK_HASH for ${it.name}")
listOfNamesWithoutPkHash.add(it.name)
diff --git a/node/src/test/kotlin/net/corda/node/services/network/NetworkMapUpdaterTest.kt b/node/src/test/kotlin/net/corda/node/services/network/NetworkMapUpdaterTest.kt
index 07a4a5b668..5e1062c39b 100644
--- a/node/src/test/kotlin/net/corda/node/services/network/NetworkMapUpdaterTest.kt
+++ b/node/src/test/kotlin/net/corda/node/services/network/NetworkMapUpdaterTest.kt
@@ -48,7 +48,6 @@ import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.api.Assertions.assertThatThrownBy
import org.hamcrest.collection.IsIterableContainingInAnyOrder
import org.junit.After
-import org.junit.Assert
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@@ -76,6 +75,8 @@ import kotlin.io.path.exists
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
+import org.hamcrest.MatcherAssert.assertThat
+
class NetworkMapUpdaterTest {
@Rule
@@ -161,7 +162,7 @@ class NetworkMapUpdaterTest {
//TODO: Remove sleep in unit test.
Thread.sleep(2L * cacheExpiryMs)
- Assert.assertThat(networkMapCache.allNodeHashes, IsIterableContainingInAnyOrder.containsInAnyOrder(signedNodeInfo1.raw.hash, signedNodeInfo2.raw.hash))
+ assertThat(networkMapCache.allNodeHashes, IsIterableContainingInAnyOrder.containsInAnyOrder(signedNodeInfo1.raw.hash, signedNodeInfo2.raw.hash))
assertThat(nodeReadyFuture).isDone()
@@ -173,7 +174,7 @@ class NetworkMapUpdaterTest {
Thread.sleep(2L * cacheExpiryMs)
//4 node info from network map, and 1 from file.
- Assert.assertThat(networkMapCache.allNodeHashes, IsIterableContainingInAnyOrder.containsInAnyOrder(
+ assertThat(networkMapCache.allNodeHashes, IsIterableContainingInAnyOrder.containsInAnyOrder(
signedNodeInfo1.raw.hash,
signedNodeInfo2.raw.hash,
signedNodeInfo3.raw.hash,
@@ -204,7 +205,7 @@ class NetworkMapUpdaterTest {
Thread.sleep(2L * cacheExpiryMs)
- Assert.assertThat(networkMapCache.allNodeHashes, IsIterableContainingInAnyOrder.containsInAnyOrder(
+ assertThat(networkMapCache.allNodeHashes, IsIterableContainingInAnyOrder.containsInAnyOrder(
signedNodeInfo1.raw.hash,
signedNodeInfo2.raw.hash,
signedNodeInfo3.raw.hash,
@@ -248,7 +249,7 @@ class NetworkMapUpdaterTest {
//TODO: Remove sleep in unit test.
Thread.sleep(2L * cacheExpiryMs)
- Assert.assertThat(networkMapCache.allNodeHashes, IsIterableContainingInAnyOrder.containsInAnyOrder(
+ assertThat(networkMapCache.allNodeHashes, IsIterableContainingInAnyOrder.containsInAnyOrder(
signedNodeInfo1.raw.hash,
signedNodeInfo2.raw.hash
))
diff --git a/node/src/test/kotlin/net/corda/node/services/persistence/DBCheckpointStorageTests.kt b/node/src/test/kotlin/net/corda/node/services/persistence/DBCheckpointStorageTests.kt
index 885b3a2166..a0ea98fd67 100644
--- a/node/src/test/kotlin/net/corda/node/services/persistence/DBCheckpointStorageTests.kt
+++ b/node/src/test/kotlin/net/corda/node/services/persistence/DBCheckpointStorageTests.kt
@@ -454,7 +454,7 @@ class DBCheckpointStorageTests {
val deserializedException = exceptionDetails.value?.let { SerializedBytes(it) }?.deserialize(context = SerializationDefaults.STORAGE_CONTEXT)
// IllegalStateException does not implement [CordaThrowable] therefore gets deserialized as a [CordaRuntimeException]
assertTrue(deserializedException is CordaRuntimeException)
- val cordaRuntimeException = deserializedException as CordaRuntimeException
+ val cordaRuntimeException = deserializedException
assertEquals(IllegalStateException::class.java.name, cordaRuntimeException.originalExceptionClassName)
assertEquals("I am a naughty exception", cordaRuntimeException.originalMessage!!)
}
diff --git a/node/src/test/kotlin/net/corda/notary/experimental/raft/RaftTransactionCommitLogTests.kt b/node/src/test/kotlin/net/corda/notary/experimental/raft/RaftTransactionCommitLogTests.kt
index a794397fb1..21e55d7d32 100644
--- a/node/src/test/kotlin/net/corda/notary/experimental/raft/RaftTransactionCommitLogTests.kt
+++ b/node/src/test/kotlin/net/corda/notary/experimental/raft/RaftTransactionCommitLogTests.kt
@@ -26,9 +26,9 @@ import net.corda.testing.internal.LogHelper
import net.corda.testing.internal.TestingNamedCacheFactory
import net.corda.testing.internal.configureDatabase
import net.corda.testing.node.MockServices.Companion.makeTestDataSourceProperties
+import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.instanceOf
import org.junit.After
-import org.junit.Assert.assertThat
import org.junit.Before
import org.junit.Rule
import org.junit.Test
diff --git a/serialization-tests/src/test/kotlin/net/corda/serialization/internal/amqp/AbstractAMQPSerializationSchemeTest.kt b/serialization-tests/src/test/kotlin/net/corda/serialization/internal/amqp/AbstractAMQPSerializationSchemeTest.kt
index 1bab4af8c3..0a9844442b 100644
--- a/serialization-tests/src/test/kotlin/net/corda/serialization/internal/amqp/AbstractAMQPSerializationSchemeTest.kt
+++ b/serialization-tests/src/test/kotlin/net/corda/serialization/internal/amqp/AbstractAMQPSerializationSchemeTest.kt
@@ -12,7 +12,7 @@ import net.corda.coretesting.internal.createTestSerializationEnv
import org.hamcrest.CoreMatchers
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.Matchers
-import org.junit.Assert
+import org.hamcrest.MatcherAssert.assertThat
import org.junit.Test
import java.net.URLClassLoader
import java.util.concurrent.ThreadLocalRandom
@@ -61,10 +61,10 @@ class AbstractAMQPSerializationSchemeTest {
val testString = "TEST${ThreadLocalRandom.current().nextInt()}"
val serialized = scheme.serialize(testString, context)
val deserialized = serialized.deserialize(context = context, serializationFactory = serializationEnvironment.serializationFactory)
- Assert.assertThat(testString, `is`(deserialized))
- Assert.assertThat(backingMap.size, `is`(Matchers.lessThanOrEqualTo(maxFactories)))
+ assertThat(testString, `is`(deserialized))
+ assertThat(backingMap.size, `is`(Matchers.lessThanOrEqualTo(maxFactories)))
}
- Assert.assertThat(backingMap.size, CoreMatchers.`is`(Matchers.lessThanOrEqualTo(maxFactories)))
+ assertThat(backingMap.size, CoreMatchers.`is`(Matchers.lessThanOrEqualTo(maxFactories)))
}
}
diff --git a/tools/bootstrapper/src/test/kotlin/net/corda/bootstrapper/NetworkBootstrapperRunnerTests.kt b/tools/bootstrapper/src/test/kotlin/net/corda/bootstrapper/NetworkBootstrapperRunnerTests.kt
index ee6c011601..e6607b58ab 100644
--- a/tools/bootstrapper/src/test/kotlin/net/corda/bootstrapper/NetworkBootstrapperRunnerTests.kt
+++ b/tools/bootstrapper/src/test/kotlin/net/corda/bootstrapper/NetworkBootstrapperRunnerTests.kt
@@ -25,6 +25,7 @@ import java.nio.file.Path
import java.nio.file.Paths
import java.security.PublicKey
import kotlin.io.path.Path
+import kotlin.io.path.createTempDirectory
import kotlin.io.path.div
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
@@ -99,7 +100,7 @@ class NetworkBootstrapperRunnerTests {
@Test(timeout=300_000)
fun `test when base directory is specified it is passed through to the bootstrapper`() {
val (runner, mockBootstrapper) = getRunner()
- val tempDir = createTempDir()
+ val tempDir = createTempDirectory().toFile()
runner.dir = tempDir.toPath()
val exitCode = runner.runProgram()
verify(mockBootstrapper).bootstrap(tempDir.toPath().toAbsolutePath().normalize(), CopyCordapps.FirstRunOnly, NetworkParametersOverrides())
diff --git a/tools/error-tool/src/test/kotlin/net/corda/errorUtilities/resourceGenerator/ResourceGeneratorTest.kt b/tools/error-tool/src/test/kotlin/net/corda/errorUtilities/resourceGenerator/ResourceGeneratorTest.kt
index e5ddba6134..5f0de9c317 100644
--- a/tools/error-tool/src/test/kotlin/net/corda/errorUtilities/resourceGenerator/ResourceGeneratorTest.kt
+++ b/tools/error-tool/src/test/kotlin/net/corda/errorUtilities/resourceGenerator/ResourceGeneratorTest.kt
@@ -4,6 +4,7 @@ import junit.framework.TestCase.assertEquals
import net.corda.common.logging.errorReporting.ResourceBundleProperties
import org.junit.Test
import java.util.*
+import kotlin.io.path.createTempDirectory
class ResourceGeneratorTest {
@@ -42,7 +43,7 @@ class ResourceGeneratorTest {
assertEquals(expectedCodes().map { "$it.properties" }.toSet(), missing.toSet())
// Now check that all resource files that should be created are
- val tempDir = createTempDir()
+ val tempDir = createTempDirectory().toFile()
resourceGenerator.createResources(missing, tempDir.toPath())
val createdFiles = tempDir.walkTopDown().filter { it.isFile && it.extension == "properties" }.map { it.name }.toSet()
assertEquals(missing.toSet(), createdFiles)
diff --git a/tools/loadtest/src/main/kotlin/net/corda/loadtest/ConnectionManager.kt b/tools/loadtest/src/main/kotlin/net/corda/loadtest/ConnectionManager.kt
index d9b6e6bbff..00a86feccb 100644
--- a/tools/loadtest/src/main/kotlin/net/corda/loadtest/ConnectionManager.kt
+++ b/tools/loadtest/src/main/kotlin/net/corda/loadtest/ConnectionManager.kt
@@ -44,7 +44,7 @@ fun setupJSchWithSshAgent(): JSch {
override fun getName() = String(identity.comment)
override fun isEncrypted() = false
override fun getSignature(data: ByteArray?) = agentProxy.sign(identity.blob, data)
- @Suppress("OverridingDeprecatedMember")
+ @Suppress("OVERRIDE_DEPRECATION")
override fun decrypt() = true
override fun getPublicKeyBlob() = identity.blob