Skip to content

Commit 4e54c0d

Browse files
committed
PDFBOX-5660: Sonar fix
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1924871 13f79535-47bb-0310-9956-ffa450edef68
1 parent 568bf18 commit 4e54c0d

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

fontbox/src/test/java/org/apache/fontbox/cff/DataInputRandomAccessTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void testReadByte() throws IOException
5353
assertEquals(-7, dataInput.readByte());
5454
dataInput.setPosition(dataInput.length() - 1);
5555
assertEquals(-9, dataInput.readByte());
56-
assertThrows(IOException.class, () -> dataInput.readByte());
56+
assertThrows(IOException.class, dataInput::readByte);
5757
}
5858

5959
@Test
@@ -68,7 +68,7 @@ void testReadUnsignedByte() throws IOException
6868
assertEquals(249, dataInput.readUnsignedByte());
6969
dataInput.setPosition(dataInput.length() - 1);
7070
assertEquals(247, dataInput.readUnsignedByte());
71-
assertThrows(IOException.class, () -> dataInput.readUnsignedByte());
71+
assertThrows(IOException.class, dataInput::readUnsignedByte);
7272
}
7373

7474
@Test
@@ -103,7 +103,7 @@ void testReadShort() throws IOException
103103
assertEquals((short) 0x000F, dataInput.readShort());
104104
assertEquals((short) 0xAA00, dataInput.readShort());
105105
assertEquals((short) 0xFEFF, dataInput.readShort());
106-
assertThrows(IOException.class, () -> dataInput.readShort());
106+
assertThrows(IOException.class, dataInput::readShort);
107107
}
108108

109109
@Test
@@ -114,11 +114,11 @@ void testReadUnsignedShort() throws IOException
114114
assertEquals(0x000F, dataInput.readUnsignedShort());
115115
assertEquals(0xAA00, dataInput.readUnsignedShort());
116116
assertEquals(0xFEFF, dataInput.readUnsignedShort());
117-
assertThrows(IOException.class, () -> dataInput.readUnsignedShort());
117+
assertThrows(IOException.class, dataInput::readUnsignedShort);
118118

119119
byte[] data2 = { 0x00 };
120120
DataInput dataInput2 = new DataInputRandomAccessRead(new RandomAccessReadBuffer(data2));
121-
assertThrows(IOException.class, () -> dataInput2.readUnsignedShort());
121+
assertThrows(IOException.class, dataInput2::readUnsignedShort);
122122
}
123123

124124
@Test
@@ -129,11 +129,11 @@ void testReadInt() throws IOException
129129
DataInput dataInput = new DataInputRandomAccessRead(new RandomAccessReadBuffer(data));
130130
assertEquals(0x000FAA00, dataInput.readInt());
131131
assertEquals(0xFEFF3050, dataInput.readInt());
132-
assertThrows(IOException.class, () -> dataInput.readInt());
132+
assertThrows(IOException.class, dataInput::readInt);
133133

134134
byte[] data2 = { 0x00, 0x0F, (byte) 0xAA };
135135
DataInput dataInput2 = new DataInputRandomAccessRead(new RandomAccessReadBuffer(data2));
136-
assertThrows(IOException.class, () -> dataInput2.readInt());
136+
assertThrows(IOException.class, dataInput2::readInt);
137137

138138
}
139139
}

fontbox/src/test/java/org/apache/fontbox/cff/DataInputTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void testReadByte() throws IOException
5252
assertEquals(-7, dataInput.readByte());
5353
dataInput.setPosition(dataInput.length() - 1);
5454
assertEquals(-9, dataInput.readByte());
55-
assertThrows(IOException.class, () -> dataInput.readByte());
55+
assertThrows(IOException.class, dataInput::readByte);
5656
}
5757

5858
@Test
@@ -67,7 +67,7 @@ void testReadUnsignedByte() throws IOException
6767
assertEquals(249, dataInput.readUnsignedByte());
6868
dataInput.setPosition(dataInput.length() - 1);
6969
assertEquals(247, dataInput.readUnsignedByte());
70-
assertThrows(IOException.class, () -> dataInput.readUnsignedByte());
70+
assertThrows(IOException.class, dataInput::readUnsignedByte);
7171
}
7272

7373
@Test
@@ -102,7 +102,7 @@ void testReadShort() throws IOException
102102
assertEquals((short) 0x000F, dataInput.readShort());
103103
assertEquals((short) 0xAA00, dataInput.readShort());
104104
assertEquals((short) 0xFEFF, dataInput.readShort());
105-
assertThrows(IOException.class, () -> dataInput.readShort());
105+
assertThrows(IOException.class, dataInput::readShort);
106106
}
107107

108108
@Test
@@ -113,11 +113,11 @@ void testReadUnsignedShort() throws IOException
113113
assertEquals(0x000F, dataInput.readUnsignedShort());
114114
assertEquals(0xAA00, dataInput.readUnsignedShort());
115115
assertEquals(0xFEFF, dataInput.readUnsignedShort());
116-
assertThrows(IOException.class, () -> dataInput.readUnsignedShort());
116+
assertThrows(IOException.class, dataInput::readUnsignedShort);
117117

118118
byte[] data2 = { 0x00 };
119119
DataInput dataInput2 = new DataInputByteArray(data2);
120-
assertThrows(IOException.class, () -> dataInput2.readUnsignedShort());
120+
assertThrows(IOException.class, dataInput2::readUnsignedShort);
121121
}
122122

123123
@Test
@@ -128,11 +128,11 @@ void testReadInt() throws IOException
128128
DataInput dataInput = new DataInputByteArray(data);
129129
assertEquals(0x000FAA00, dataInput.readInt());
130130
assertEquals(0xFEFF3050, dataInput.readInt());
131-
assertThrows(IOException.class, () -> dataInput.readInt());
131+
assertThrows(IOException.class, dataInput::readInt);
132132

133133
byte[] data2 = { 0x00, 0x0F, (byte) 0xAA };
134134
DataInput dataInput2 = new DataInputByteArray(data2);
135-
assertThrows(IOException.class, () -> dataInput2.readInt());
135+
assertThrows(IOException.class, dataInput2::readInt);
136136

137137
}
138138
}

0 commit comments

Comments
 (0)