@Test public void shouldReadManifest() throws Exception { ManifestReader manifestReader = new ManifestReader(); Manifest manifest = manifestReader.readManifest( "/test-manifest.txt" ); assertThat( manifest, is( theTestManifest() ) ); }
public Manifest readManifest( String name ) throws IOException { InputStream inputStream = getClass().getResourceAsStream( name ); HashSet<Producer> producers = new HashSet<>(); for ( String line : IOUtils.readLines( inputStream ) ) { String[] uriAndPaths = line.split( ",", 2 ); String uri = uriAndPaths[0]; String paths = uriAndPaths[1]; HashSet<Event> events = new HashSet<>(); for ( String path : paths.split( "," ) ) { events.add( new Event( path ) ); } producers.add( new Producer( uri, events ) ); } return new Manifest( producers ); }
ManifestReader { public Manifest readManifest( String name ) throws IOException { InputStream inputStream = getClass().getResourceAsStream( name ); HashSet<Producer> producers = new HashSet<>(); for ( String line : IOUtils.readLines( inputStream ) ) { String[] uriAndPaths = line.split( ",", 2 ); String uri = uriAndPaths[0]; String paths = uriAndPaths[1]; HashSet<Event> events = new HashSet<>(); for ( String path : paths.split( "," ) ) { events.add( new Event( path ) ); } producers.add( new Producer( uri, events ) ); } return new Manifest( producers ); } }
ManifestReader { public Manifest readManifest( String name ) throws IOException { InputStream inputStream = getClass().getResourceAsStream( name ); HashSet<Producer> producers = new HashSet<>(); for ( String line : IOUtils.readLines( inputStream ) ) { String[] uriAndPaths = line.split( ",", 2 ); String uri = uriAndPaths[0]; String paths = uriAndPaths[1]; HashSet<Event> events = new HashSet<>(); for ( String path : paths.split( "," ) ) { events.add( new Event( path ) ); } producers.add( new Producer( uri, events ) ); } return new Manifest( producers ); }  }
ManifestReader { public Manifest readManifest( String name ) throws IOException { InputStream inputStream = getClass().getResourceAsStream( name ); HashSet<Producer> producers = new HashSet<>(); for ( String line : IOUtils.readLines( inputStream ) ) { String[] uriAndPaths = line.split( ",", 2 ); String uri = uriAndPaths[0]; String paths = uriAndPaths[1]; HashSet<Event> events = new HashSet<>(); for ( String path : paths.split( "," ) ) { events.add( new Event( path ) ); } producers.add( new Producer( uri, events ) ); } return new Manifest( producers ); }  Manifest readManifest( String name ); }
ManifestReader { public Manifest readManifest( String name ) throws IOException { InputStream inputStream = getClass().getResourceAsStream( name ); HashSet<Producer> producers = new HashSet<>(); for ( String line : IOUtils.readLines( inputStream ) ) { String[] uriAndPaths = line.split( ",", 2 ); String uri = uriAndPaths[0]; String paths = uriAndPaths[1]; HashSet<Event> events = new HashSet<>(); for ( String path : paths.split( "," ) ) { events.add( new Event( path ) ); } producers.add( new Producer( uri, events ) ); } return new Manifest( producers ); }  Manifest readManifest( String name );  }