|
23 | 23 | import static org.junit.Assert.assertNotSame; |
24 | 24 | import static org.junit.Assert.assertSame; |
25 | 25 | import static org.junit.Assert.assertTrue; |
| 26 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
26 | 27 |
|
27 | 28 | import java.io.IOException; |
28 | 29 | import java.io.Serializable; |
@@ -221,18 +222,18 @@ public void testInterceptingProxySerializable() throws Exception |
221 | 222 | assertSerializable(proxy); |
222 | 223 | } |
223 | 224 |
|
224 | | - @Test(expected = IOException.class) |
225 | | - public void testInterceptorProxyWithCheckedException() throws Exception |
| 225 | + @Test |
| 226 | + public void testInterceptorProxyWithCheckedException() |
226 | 227 | { |
227 | 228 | final Echo proxy = factory.createInterceptorProxy(new EchoImpl(), new NoOpMethodInterceptor(), ECHO_ONLY); |
228 | | - proxy.ioException(); |
| 229 | + assertThrows(IOException.class, () -> proxy.ioException()); |
229 | 230 | } |
230 | 231 |
|
231 | | - @Test(expected = IllegalArgumentException.class) |
232 | | - public void testInterceptorProxyWithUncheckedException() throws Exception |
| 232 | + @Test |
| 233 | + public void testInterceptorProxyWithUncheckedException() |
233 | 234 | { |
234 | 235 | final Echo proxy = factory.createInterceptorProxy(new EchoImpl(), new NoOpMethodInterceptor(), ECHO_ONLY); |
235 | | - proxy.illegalArgument(); |
| 236 | + assertThrows(IllegalArgumentException.class, () -> proxy.illegalArgument()); |
236 | 237 | } |
237 | 238 |
|
238 | 239 | @Test |
@@ -326,18 +327,18 @@ public void testPrimitiveParameter() |
326 | 327 | assertEquals(1, echo.echoBack(1)); |
327 | 328 | } |
328 | 329 |
|
329 | | - @Test(expected = IOException.class) |
330 | | - public void testProxyWithCheckedException() throws Exception |
| 330 | + @Test |
| 331 | + public void testProxyWithCheckedException() |
331 | 332 | { |
332 | 333 | final Echo proxy = factory.createDelegatorProxy(new ConstantProvider<Echo>(new EchoImpl()), Echo.class); |
333 | | - proxy.ioException(); |
| 334 | + assertThrows(IOException.class, () -> proxy.ioException()); |
334 | 335 | } |
335 | 336 |
|
336 | | - @Test(expected = IllegalArgumentException.class) |
337 | | - public void testProxyWithUncheckedException() throws Exception |
| 337 | + @Test |
| 338 | + public void testProxyWithUncheckedException() |
338 | 339 | { |
339 | 340 | final Echo proxy = factory.createDelegatorProxy(new ConstantProvider<Echo>(new EchoImpl()), Echo.class); |
340 | | - proxy.illegalArgument(); |
| 341 | + assertThrows(IllegalArgumentException.class, () -> proxy.illegalArgument()); |
341 | 342 | } |
342 | 343 |
|
343 | 344 | @Test |
|
0 commit comments