### Question:
ResourceStreamSource extends StreamSource { @Override public InputStream getInputStream () { final InputStream aIS = m_aISP.getInputStream (); if (aIS == null) throw new IllegalStateException ("Failed to open input stream for " + m_aISP); return aIS; } ResourceStreamSource(@Nonnull final IReadableResource aResource);  ResourceStreamSource(@Nonnull final IHasInputStream aISP, @Nullable final String sSystemID); @Nonnull IHasInputStream getInputStreamProvider(); @Override InputStream getInputStream(); @Override String toString();  }### Answer:
@Test public void testBasic () { final IReadableResource aRes = new ClassPathResource ("xml/test1.xslt"); assertTrue (aRes.exists ()); final ResourceStreamSource src = new ResourceStreamSource (aRes); final InputStream is = src.getInputStream (); assertNotNull (is); StreamHelper.close (is); assertEquals (aRes.getResourceID (), src.getSystemId ()); assertNull (src.getPublicId ()); CommonsTestHelper.testToStringImplementation (src); }
@SuppressWarnings ("unused") @Test public void testCreationError () { try { new ResourceStreamSource (null); fail (); } catch (final NullPointerException ex) {} try { new ResourceStreamSource (null, "systid"); fail (); } catch (final NullPointerException ex) {} try { new ResourceStreamSource (new MockNullInputStreamProvider (), "systid").getInputStream (); fail (); } catch (final IllegalStateException ex) {} }