()
| 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(); |
nothing calls this directly
no test coverage detected