diff --git a/libraries/kotlin.test/jvm/src/main/kotlin/CollectionAssertions.kt b/libraries/kotlin.test/jvm/src/main/kotlin/CollectionAssertions.kt index 60a690596f5..26136ba3a35 100644 --- a/libraries/kotlin.test/jvm/src/main/kotlin/CollectionAssertions.kt +++ b/libraries/kotlin.test/jvm/src/main/kotlin/CollectionAssertions.kt @@ -3,49 +3,49 @@ * that can be found in the license/LICENSE.txt file. */ -@file:Suppress("DEPRECATION") +@file:Suppress("DEPRECATION_ERROR") package kotlin.test import java.util.* -// TODO: Drop in 1.2 +// TODO: Drop entirely in 1.4 -@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.") +@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.", level = DeprecationLevel.ERROR) class CollectionAssertionSession>(val collection: C) -@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.") +@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.", level = DeprecationLevel.ERROR) inline fun > assert(collection: C, block: CollectionAssertionSession.() -> Unit) { CollectionAssertionSession(collection).block() } -@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.") +@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.", level = DeprecationLevel.ERROR) fun > CollectionAssertionSession<*, C>.sizeShouldBe(expectedSize: Int, message: String? = null) { assertEquals(expectedSize, collection.size, message ?: "collection should have size $expectedSize but it is ${collection.size}") } -@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.") +@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.", level = DeprecationLevel.ERROR) fun CollectionAssertionSession.elementAtShouldBe(position: Int, expected: T, message: String? = null) { assertEquals(expected, collection.elementAt(position), message ?: "element at $position should be $expected") } -@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.") +@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.", level = DeprecationLevel.ERROR) fun > CollectionAssertionSession.elementAtShouldComply(position: Int, message: String? = null, predicate: (T) -> Boolean) { assertTrue(message) { predicate(collection.elementAt(position)) } } -@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.") +@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.", level = DeprecationLevel.ERROR) fun CollectionAssertionSession.lastElementShouldBe(expected: T, message: String? = null) { assertEquals(expected, collection.last(), message ?: "the last element should be $expected") } -@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.") +@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.", level = DeprecationLevel.ERROR) fun CollectionAssertionSession.containsAll(vararg elements: T) { for (e in elements) { assertTrue(message = "Element $e is missing in the collection") { e in collection } } } -@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.") +@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.", level = DeprecationLevel.ERROR) fun > CollectionAssertionSession.shouldBe(expectedElements: Iterable, message: String? = null) { val actual = collection.iterator() val expected = expectedElements.iterator() @@ -62,7 +62,7 @@ fun > CollectionAssertionSession.shouldBe(expectedElemen } } -@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.") +@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.", level = DeprecationLevel.ERROR) fun > CollectionAssertionSession.shouldBeSet(other: Set, message: String? = null) { for (e in other) { if (e !in collection) { @@ -76,7 +76,7 @@ fun > CollectionAssertionSession.shouldBeSet(other: Set, m } } -@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.") +@Deprecated("This is an experimental part of the API. It may be changed or removed in newer releases.", level = DeprecationLevel.ERROR) fun > CollectionAssertionSession.shouldBeSet(vararg other: T) { val otherSet = HashSet() for (e in other) { diff --git a/libraries/kotlin.test/jvm/src/test/kotlin/CollectionAssertionTest.kt b/libraries/kotlin.test/jvm/src/test/kotlin/CollectionAssertionTest.kt index e9a24a43bcf..4385dc21458 100644 --- a/libraries/kotlin.test/jvm/src/test/kotlin/CollectionAssertionTest.kt +++ b/libraries/kotlin.test/jvm/src/test/kotlin/CollectionAssertionTest.kt @@ -3,7 +3,7 @@ * that can be found in the license/LICENSE.txt file. */ -@file:Suppress("DEPRECATION") +@file:Suppress("DEPRECATION_ERROR") package kotlin.test.tests