### Question:
RDFSource { public InputStream openStream() throws IOException { if (input != null) { return input; } else if (resource == null) { throw new IllegalStateException(); } else if (resource.startsWith("classpath:")) { String name = resource.substring(10); if (name.startsWith("/")) { name = name.substring(1); } return RDFSource.class.getClassLoader().getResourceAsStream(name); } else { return new URL(resource).openStream(); } } RDFSource(String resource, Format format, String context);  RDFSource(InputStream input, Format format, String context); String getContext(); Format getFormat(); String getResource(); InputStream openStream();  }### Answer:
@Test public void OpenStream_with_Resource() throws IOException { assertTrue(new RDFSource("classpath:/test.ttl", Format.TURTLE, "test:context").openStream() != null); assertTrue(new RDFSource("file:src/test/resources/test.ttl", Format.TURTLE, "test:context").openStream() != null); assertTrue(new RDFSource("classpath:/tes.ttl", Format.TURTLE, "test:context").openStream() == null); }
@Test public void OpenStream_with_Input() throws IOException { InputStream input = new ByteArrayInputStream("abc".getBytes("UTF-8")); RDFSource source = new RDFSource(input, Format.TURTLE, "test:context"); assertEquals("abc", new String(ByteStreams.toByteArray(source.openStream()), Charsets.UTF_8)); }