@@ -75,13 +75,31 @@ class KotlinAssertionsTests {
7575 val actual = assertDoesNotThrow { 1 }
7676 assertEquals(1 , actual)
7777 },
78+ dynamicTest(" for no arguments variant (suspended)" ) {
79+ runBlocking {
80+ val actual = assertDoesNotThrow { suspend { 1 }() }
81+ assertEquals(1 , actual)
82+ }
83+ },
7884 dynamicTest(" for message variant" ) {
7985 val actual = assertDoesNotThrow(" message" ) { 2 }
8086 assertEquals(2 , actual)
8187 },
88+ dynamicTest(" for message variant (suspended)" ) {
89+ runBlocking {
90+ val actual = assertDoesNotThrow(" message" ) { suspend { 2 }() }
91+ assertEquals(2 , actual)
92+ }
93+ },
8294 dynamicTest(" for message supplier variant" ) {
8395 val actual = assertDoesNotThrow({ " message" }) { 3 }
8496 assertEquals(3 , actual)
97+ },
98+ dynamicTest(" for message supplier variant (suspended)" ) {
99+ runBlocking {
100+ val actual = assertDoesNotThrow({ " message" }) { suspend { 3 }() }
101+ assertEquals(3 , actual)
102+ }
85103 }
86104 )),
87105 dynamicContainer(" fails when an exception is thrown" , Stream .of(
@@ -94,6 +112,19 @@ class KotlinAssertionsTests {
94112 assertMessageEquals(exception,
95113 " Unexpected exception thrown: org.opentest4j.AssertionFailedError: fail" )
96114 },
115+ dynamicTest(" for no arguments variant (suspended)" ) {
116+ runBlocking {
117+ val exception = assertThrows<AssertionError > {
118+ assertDoesNotThrow {
119+ suspend { fail(" fail" ) }()
120+ }
121+ }
122+ assertMessageEquals(
123+ exception,
124+ " Unexpected exception thrown: org.opentest4j.AssertionFailedError: fail"
125+ )
126+ }
127+ },
97128 dynamicTest(" for message variant" ) {
98129 val exception = assertThrows<AssertionError > {
99130 assertDoesNotThrow(" Does not throw" ) {
@@ -103,6 +134,19 @@ class KotlinAssertionsTests {
103134 assertMessageEquals(exception,
104135 " Does not throw ==> Unexpected exception thrown: org.opentest4j.AssertionFailedError: fail" )
105136 },
137+ dynamicTest(" for message variant (suspended)" ) {
138+ runBlocking {
139+ val exception = assertThrows<AssertionError > {
140+ assertDoesNotThrow(" Does not throw" ) {
141+ suspend { fail(" fail" ) }()
142+ }
143+ }
144+ assertMessageEquals(
145+ exception,
146+ " Does not throw ==> Unexpected exception thrown: org.opentest4j.AssertionFailedError: fail"
147+ )
148+ }
149+ },
106150 dynamicTest(" for message supplier variant" ) {
107151 val exception = assertThrows<AssertionError > {
108152 assertDoesNotThrow({ " Does not throw" }) {
@@ -111,6 +155,19 @@ class KotlinAssertionsTests {
111155 }
112156 assertMessageEquals(exception,
113157 " Does not throw ==> Unexpected exception thrown: org.opentest4j.AssertionFailedError: fail" )
158+ },
159+ dynamicTest(" for message supplier variant (suspended)" ) {
160+ runBlocking {
161+ val exception = assertThrows<AssertionError > {
162+ assertDoesNotThrow({ " Does not throw" }) {
163+ suspend { fail(" fail" ) }()
164+ }
165+ }
166+ assertMessageEquals(
167+ exception,
168+ " Does not throw ==> Unexpected exception thrown: org.opentest4j.AssertionFailedError: fail"
169+ )
170+ }
114171 }
115172 ))
116173 )
0 commit comments