aboutsummaryrefslogtreecommitdiff
path: root/android/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'android/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java')
-rw-r--r--android/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java22
1 files changed, 6 insertions, 16 deletions
diff --git a/android/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java b/android/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java
index 160df410b..faa0b9549 100644
--- a/android/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java
+++ b/android/guava-tests/test/com/google/common/io/LittleEndianDataInputStreamTest.java
@@ -17,6 +17,7 @@
package com.google.common.io;
import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertThrows;
import com.google.common.primitives.Bytes;
import java.io.ByteArrayInputStream;
@@ -75,32 +76,21 @@ public class LittleEndianDataInputStreamTest extends TestCase {
public void testReadUnsignedByte_eof() throws IOException {
DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(new byte[0]));
- try {
- in.readUnsignedByte();
- fail();
- } catch (EOFException expected) {
- }
+ assertThrows(EOFException.class, () -> in.readUnsignedByte());
}
public void testReadUnsignedShort_eof() throws IOException {
byte[] buf = {23};
DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(buf));
- try {
- in.readUnsignedShort();
- fail();
- } catch (EOFException expected) {
- }
+ assertThrows(EOFException.class, () -> in.readUnsignedShort());
}
@SuppressWarnings("DoNotCall")
public void testReadLine() throws IOException {
DataInput in = new LittleEndianDataInputStream(new ByteArrayInputStream(data));
- try {
- in.readLine();
- fail();
- } catch (UnsupportedOperationException expected) {
- assertThat(expected).hasMessageThat().isEqualTo("readLine is not supported");
- }
+ UnsupportedOperationException expected =
+ assertThrows(UnsupportedOperationException.class, () -> in.readLine());
+ assertThat(expected).hasMessageThat().isEqualTo("readLine is not supported");
}
public void testReadLittleEndian() throws IOException {