### Question:
TempSharedFileInputStream extends SharedFileInputStream { @Override protected void finalize () throws Throwable { try { closeAll (); } catch (final Exception ex) { LOGGER.error ("Exception in finalize()", ex); } super.finalize (); } private  TempSharedFileInputStream(@Nonnull final File aFile); @Override void close(); void closeAll(); @Nonnull static TempSharedFileInputStream getTempSharedFileInputStream(@Nonnull @WillClose final InputStream aIS,
                                                                        @Nonnull final String sName);  }### Answer:
@Test public void testFinalize () throws Exception { for (int i = 0; i < 10000; i++) { final String sSrcData = "123456"; try (final InputStream is = new NonBlockingByteArrayInputStream (sSrcData.getBytes (StandardCharsets.ISO_8859_1)); final TempSharedFileInputStream aSharedIS = TempSharedFileInputStream.getTempSharedFileInputStream (is, "myName")) { final int t = aSharedIS.read (); assertEquals (t, sSrcData.charAt (0)); aSharedIS.closeAll (); } } }