Skip to content

Commit 4c5048b

Browse files
committed
Sort members
1 parent a68a9f1 commit 4c5048b

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

src/test/java/org/apache/commons/io/output/ThresholdingOutputStreamTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -208,26 +208,6 @@ void testThresholdIOConsumerIOException() throws IOException {
208208
}
209209
}
210210

211-
@Test
212-
void testThresholdReachedRetriedAfterException() throws IOException {
213-
final int threshold = 1;
214-
final AtomicInteger counter = new AtomicInteger();
215-
try (ThresholdingOutputStream out = new ThresholdingOutputStream(threshold, tos -> {
216-
if (counter.incrementAndGet() == 1) {
217-
throw new IOException("Threshold reached.");
218-
}
219-
}, os -> new ByteArrayOutputStream(4))) {
220-
assertThresholdingInitialState(out, threshold, 0);
221-
out.write('a');
222-
assertFalse(out.isThresholdExceeded());
223-
assertThrows(IOException.class, () -> out.write('a'));
224-
assertFalse(out.isThresholdExceeded());
225-
out.write('a');
226-
assertEquals(2, counter.get());
227-
assertTrue(out.isThresholdExceeded());
228-
}
229-
}
230-
231211
@Test
232212
void testThresholdIOConsumerUncheckedException() throws IOException {
233213
final int threshold = 1;
@@ -267,6 +247,26 @@ protected void thresholdReached() throws IOException {
267247
}
268248
}
269249

250+
@Test
251+
void testThresholdReachedRetriedAfterException() throws IOException {
252+
final int threshold = 1;
253+
final AtomicInteger counter = new AtomicInteger();
254+
try (ThresholdingOutputStream out = new ThresholdingOutputStream(threshold, tos -> {
255+
if (counter.incrementAndGet() == 1) {
256+
throw new IOException("Threshold reached.");
257+
}
258+
}, os -> new ByteArrayOutputStream(4))) {
259+
assertThresholdingInitialState(out, threshold, 0);
260+
out.write('a');
261+
assertFalse(out.isThresholdExceeded());
262+
assertThrows(IOException.class, () -> out.write('a'));
263+
assertFalse(out.isThresholdExceeded());
264+
out.write('a');
265+
assertEquals(2, counter.get());
266+
assertTrue(out.isThresholdExceeded());
267+
}
268+
}
269+
270270
@Test
271271
void testThresholdZero() throws IOException {
272272
final AtomicBoolean reached = new AtomicBoolean();

0 commit comments

Comments
 (0)