Skip to content

Commit e734b30

Browse files
committed
Remove useless lambda block.
1 parent c778bf7 commit e734b30

1 file changed

Lines changed: 8 additions & 24 deletions

File tree

src/test/java/org/apache/commons/io/input/UnsynchronizedByteArrayInputStreamTest.java

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -163,72 +163,56 @@ void testConstructor3() {
163163

164164
@Test
165165
void testInvalidConstructor2OffsetUnder() {
166-
assertThrows(IllegalArgumentException.class, () -> {
167-
newStream(IOUtils.EMPTY_BYTE_ARRAY, -1);
168-
});
166+
assertThrows(IllegalArgumentException.class, () -> newStream(IOUtils.EMPTY_BYTE_ARRAY, -1));
169167
}
170168

171169
@Test
172170
void testInvalidConstructor3LengthUnder() {
173-
assertThrows(IllegalArgumentException.class, () -> {
174-
newStream(IOUtils.EMPTY_BYTE_ARRAY, 0, -1);
175-
});
171+
assertThrows(IllegalArgumentException.class, () -> newStream(IOUtils.EMPTY_BYTE_ARRAY, 0, -1));
176172
}
177173

178174
@Test
179175
void testInvalidConstructor3OffsetUnder() {
180-
assertThrows(IllegalArgumentException.class, () -> {
181-
newStream(IOUtils.EMPTY_BYTE_ARRAY, -1, 1);
182-
});
176+
assertThrows(IllegalArgumentException.class, () -> newStream(IOUtils.EMPTY_BYTE_ARRAY, -1, 1));
183177
}
184178

185179
@Test
186180
@SuppressWarnings("resource") // not necessary to close these resources
187181
void testInvalidReadArrayExplicitLenUnder() {
188182
final byte[] buf = IOUtils.EMPTY_BYTE_ARRAY;
189183
final UnsynchronizedByteArrayInputStream is = newStream(new byte[] { (byte) 0xa, (byte) 0xb, (byte) 0xc });
190-
assertThrows(IndexOutOfBoundsException.class, () -> {
191-
is.read(buf, 0, -1);
192-
});
184+
assertThrows(IndexOutOfBoundsException.class, () -> is.read(buf, 0, -1));
193185
}
194186

195187
@Test
196188
void testInvalidReadArrayExplicitOffsetUnder() {
197189
final byte[] buf = IOUtils.EMPTY_BYTE_ARRAY;
198190
@SuppressWarnings("resource") // not necessary to close these resources
199191
final UnsynchronizedByteArrayInputStream is = newStream(new byte[] { (byte) 0xa, (byte) 0xb, (byte) 0xc });
200-
assertThrows(IndexOutOfBoundsException.class, () -> {
201-
is.read(buf, -1, 1);
202-
});
192+
assertThrows(IndexOutOfBoundsException.class, () -> is.read(buf, -1, 1));
203193
}
204194

205195
@Test
206196
void testInvalidReadArrayExplicitRangeOver() {
207197
final byte[] buf = IOUtils.EMPTY_BYTE_ARRAY;
208198
@SuppressWarnings("resource") // not necessary to close these resources
209199
final UnsynchronizedByteArrayInputStream is = newStream(new byte[] { (byte) 0xa, (byte) 0xb, (byte) 0xc });
210-
assertThrows(IndexOutOfBoundsException.class, () -> {
211-
is.read(buf, 0, 1);
212-
});
200+
assertThrows(IndexOutOfBoundsException.class, () -> is.read(buf, 0, 1));
213201
}
214202

215203
@Test
216204
void testInvalidReadArrayNull() {
217205
final byte[] buf = null;
218206
@SuppressWarnings("resource") // not necessary to close these resources
219207
final UnsynchronizedByteArrayInputStream is = newStream(new byte[] { (byte) 0xa, (byte) 0xb, (byte) 0xc });
220-
assertThrows(NullPointerException.class, () -> {
221-
is.read(buf);
222-
});
208+
assertThrows(NullPointerException.class, () -> is.read(buf));
223209
}
224210

225211
@Test
226212
void testInvalidSkipNUnder() {
227213
@SuppressWarnings("resource") // not necessary to close these resources
228214
final UnsynchronizedByteArrayInputStream is = newStream(new byte[] { (byte) 0xa, (byte) 0xb, (byte) 0xc });
229-
assertThrows(IllegalArgumentException.class, () -> {
230-
is.skip(-1);
231-
});
215+
assertThrows(IllegalArgumentException.class, () -> is.skip(-1));
232216
}
233217

234218
@Test

0 commit comments

Comments
 (0)