MCPcopy
hub / github.com/google/guava / testErrors

Method testErrors

guava-tests/test/com/google/common/io/CloserTest.java:252–276  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

250 }
251
252 public void testErrors() throws IOException {
253 Closer closer = new Closer(suppressor);
254
255 Error c1Exception = new Error();
256 Error c2Exception = new Error();
257 Error c3Exception = new Error();
258
259 TestCloseable c1 = closer.register(TestCloseable.throwsOnClose(c1Exception));
260 TestCloseable c2 = closer.register(TestCloseable.throwsOnClose(c2Exception));
261 TestCloseable c3 = closer.register(TestCloseable.throwsOnClose(c3Exception));
262
263 try {
264 closer.close();
265 } catch (Throwable caught) {
266 assertThat(caught).isEqualTo(c3Exception);
267 }
268
269 assertTrue(c1.isClosed());
270 assertTrue(c2.isClosed());
271 assertTrue(c3.isClosed());
272
273 assertSuppressed(
274 new Suppression(c2, c3Exception, c2Exception),
275 new Suppression(c1, c3Exception, c1Exception));
276 }
277
278 public static void testSuppressingSuppressor() throws IOException {
279 Closer closer = Closer.create();

Callers

nothing calls this directly

Calls 5

registerMethod · 0.95
throwsOnCloseMethod · 0.95
closeMethod · 0.95
isClosedMethod · 0.95
assertSuppressedMethod · 0.95

Tested by

no test coverage detected