|
19 | 19 | import static com.google.common.base.Charsets.UTF_8;
|
20 | 20 | import static org.junit.Assert.assertArrayEquals;
|
21 | 21 | import static org.junit.Assert.assertEquals;
|
| 22 | +import static org.junit.Assert.assertThrows; |
22 | 23 | import static org.junit.Assert.assertTrue;
|
23 | 24 | import static org.mockito.ArgumentMatchers.anyInt;
|
24 | 25 | import static org.mockito.Mockito.mock;
|
|
32 | 33 | import java.io.IOException;
|
33 | 34 | import java.io.InputStream;
|
34 | 35 | import java.nio.InvalidMarkException;
|
35 |
| -import org.junit.Rule; |
36 | 36 | import org.junit.Test;
|
37 |
| -import org.junit.rules.ExpectedException; |
38 | 37 | import org.junit.runner.RunWith;
|
39 | 38 | import org.junit.runners.JUnit4;
|
40 | 39 |
|
|
46 | 45 | public class ReadableBuffersTest {
|
47 | 46 | private static final byte[] MSG_BYTES = "hello".getBytes(UTF_8);
|
48 | 47 |
|
49 |
| - @Rule |
50 |
| - public final ExpectedException thrown = ExpectedException.none(); |
51 |
| - |
52 | 48 | @Test
|
53 | 49 | public void empty_returnsEmptyBuffer() {
|
54 | 50 | ReadableBuffer buffer = ReadableBuffers.empty();
|
@@ -216,8 +212,7 @@ public void bufferInputStream_markDiscardedAfterDetached() throws IOException {
|
216 | 212 | InputStream inputStream = ReadableBuffers.openStream(buffer, true);
|
217 | 213 | inputStream.mark(5);
|
218 | 214 | ((Detachable) inputStream).detach();
|
219 |
| - thrown.expect(InvalidMarkException.class); |
220 |
| - inputStream.reset(); |
| 215 | + assertThrows(InvalidMarkException.class, () -> inputStream.reset()); |
221 | 216 | }
|
222 | 217 |
|
223 | 218 | @Test
|
|
0 commit comments