diff --git a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/prodbench/ObserverListBenchmark.kt b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/prodbench/ObserverListBenchmark.kt index 08cdd7f567..b5e9aee668 100644 --- a/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/prodbench/ObserverListBenchmark.kt +++ b/commons/src/jvmTest/kotlin/com/vitorpamplona/amethyst/commons/prodbench/ObserverListBenchmark.kt @@ -269,7 +269,7 @@ class ObserverListBenchmark { */ private fun allocatedBytes(): Long { val bean = ManagementFactory.getThreadMXBean() as com.sun.management.ThreadMXBean - return bean.getThreadAllocatedBytes(Thread.currentThread().id) + return bean.getThreadAllocatedBytes(Thread.currentThread().threadId()) } private fun measureAllocation( @@ -400,14 +400,14 @@ class ObserverListBenchmark { repeat(threads) { t -> thread { start.await() - val before = bean.getThreadAllocatedBytes(Thread.currentThread().id) + val before = bean.getThreadAllocatedBytes(Thread.currentThread().threadId()) var i = t while (i < ops) { val (e, note) = fx[i % fx.size] subject.new(e, note) i += threads } - total.addAndGet(bean.getThreadAllocatedBytes(Thread.currentThread().id) - before) + total.addAndGet(bean.getThreadAllocatedBytes(Thread.currentThread().threadId()) - before) done.countDown() } } diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip88Polls/Nip88PollTagsTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip88Polls/Nip88PollTagsTest.kt index 99ca75d566..06533e953f 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip88Polls/Nip88PollTagsTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip88Polls/Nip88PollTagsTest.kt @@ -42,6 +42,7 @@ import kotlin.test.Test import kotlin.test.assertContentEquals import kotlin.test.assertEquals import kotlin.test.assertFalse +import kotlin.test.assertIs import kotlin.test.assertNull import kotlin.test.assertTrue @@ -91,8 +92,7 @@ class Nip88PollTagsTest { @Test fun theSpecsPollExampleParsesFieldForField() { val event = Event.fromJson(specPoll) - assertTrue(event is PollEvent) - val poll = event as PollEvent + val poll = assertIs(event) assertEquals("Pineapple on pizza", poll.content) assertEquals(listOf("qj518h583" to "Yay", "gga6cdnqj" to "Nay"), poll.options().map { it.code to it.label }) @@ -104,8 +104,7 @@ class Nip88PollTagsTest { @Test fun theSpecsResponseExampleParsesFieldForField() { val event = Event.fromJson(specResponse) - assertTrue(event is PollResponseEvent) - val response = event as PollResponseEvent + val response = assertIs(event) assertEquals("1fc80cf813f1af33d5a435862b7ef7fb96b47e68a48f1abcadf8081f5a545550", response.poll()?.eventId) // Both tags are read. Which of them counts is the polltype's business, not the parser's.