@@ -8,31 +8,31 @@ class BasicOperationsTest : TestBase() {
88 @Test
99 fun testSimpleSendReceive () = runTest {
1010 // Parametrized common test :(
11- TestChannelKind .values() .forEach { kind -> testSendReceive(kind, 20 ) }
11+ TestChannelKind .entries .forEach { kind -> testSendReceive(kind, 20 ) }
1212 }
1313
1414 @Test
1515 fun testTrySendToFullChannel () = runTest {
16- TestChannelKind .values() .forEach { kind -> testTrySendToFullChannel(kind) }
16+ TestChannelKind .entries .forEach { kind -> testTrySendToFullChannel(kind) }
1717 }
1818
1919 @Test
2020 fun testTrySendAfterClose () = runTest {
21- TestChannelKind .values() .forEach { kind -> testTrySendAfterClose(kind) }
21+ TestChannelKind .entries .forEach { kind -> testTrySendAfterClose(kind) }
2222 }
2323
2424 @Test
2525 fun testSendAfterClose () = runTest {
26- TestChannelKind .values() .forEach { kind -> testSendAfterClose(kind) }
26+ TestChannelKind .entries .forEach { kind -> testSendAfterClose(kind) }
2727 }
2828
2929 @Test
3030 fun testReceiveCatching () = runTest {
31- TestChannelKind .values() .forEach { kind -> testReceiveCatching(kind) }
31+ TestChannelKind .entries .forEach { kind -> testReceiveCatching(kind) }
3232 }
3333
3434 @Test
35- fun testInvokeOnClose () = TestChannelKind .values() .forEach { kind ->
35+ fun testInvokeOnClose () = TestChannelKind .entries .forEach { kind ->
3636 reset()
3737 val channel = kind.create<Int >()
3838 channel.invokeOnClose {
@@ -48,7 +48,7 @@ class BasicOperationsTest : TestBase() {
4848 }
4949
5050 @Test
51- fun testInvokeOnClosed () = TestChannelKind .values() .forEach { kind ->
51+ fun testInvokeOnClosed () = TestChannelKind .entries .forEach { kind ->
5252 reset()
5353 expect(1 )
5454 val channel = kind.create<Int >()
@@ -59,7 +59,7 @@ class BasicOperationsTest : TestBase() {
5959 }
6060
6161 @Test
62- fun testMultipleInvokeOnClose () = TestChannelKind .values() .forEach { kind ->
62+ fun testMultipleInvokeOnClose () = TestChannelKind .entries .forEach { kind ->
6363 reset()
6464 val channel = kind.create<Int >()
6565 channel.invokeOnClose { expect(3 ) }
@@ -71,14 +71,16 @@ class BasicOperationsTest : TestBase() {
7171 }
7272
7373 @Test
74- fun testIterator () = runTest {
75- TestChannelKind .values() .forEach { kind ->
74+ fun testIteratorHasNextMustPrecedeNext () = runTest {
75+ TestChannelKind .entries .forEach { kind ->
7676 val channel = kind.create<Int >()
7777 val iterator = channel.iterator()
7878 assertFailsWith<IllegalStateException > { iterator.next() }
7979 channel.close()
8080 assertFailsWith<IllegalStateException > { iterator.next() }
8181 assertFalse(iterator.hasNext())
82+ assertFailsWith<NoSuchElementException > { iterator.next() }
83+ assertFailsWith<IllegalStateException > { iterator.next() }
8284 }
8385 }
8486
@@ -109,7 +111,7 @@ class BasicOperationsTest : TestBase() {
109111 try {
110112 expect(2 )
111113 channel.close()
112- } catch (e : TestException ) {
114+ } catch (_ : TestException ) {
113115 expect(4 )
114116 }
115117 }
0 commit comments