@Test public void merge() throws Exception { final ManifestDescriptor descriptor1 = new ManifestDescriptor(); descriptor1.getCachedResources().add( "1" ); descriptor1.getCachedResources().add( "2" ); descriptor1.getNetworkResources().add( "A" ); descriptor1.getNetworkResources().add( "B" ); descriptor1.getFallbackResources().put( "W", "W2" ); descriptor1.getFallbackResources().put( "X", "X2" ); descriptor1.getFallbackResources().put( "Y", "Y2" ); final ManifestDescriptor descriptor2 = new ManifestDescriptor(); descriptor2.getCachedResources().add( "1" ); descriptor2.getCachedResources().add( "3" ); descriptor2.getNetworkResources().add( "A" ); descriptor2.getNetworkResources().add( "C" ); descriptor2.getFallbackResources().put( "X", "X3" ); descriptor2.getFallbackResources().put( "Y", "Y2" ); descriptor2.getFallbackResources().put( "Z", "Z2" ); descriptor1.merge( descriptor2 ); assertEquals( descriptor2.getCachedResources().size(), 2 ); assertEquals( descriptor2.getNetworkResources().size(), 2 ); final List<String> cachedResources = descriptor1.getCachedResources(); assertEquals( cachedResources.size(), 3 ); assertTrue( cachedResources.contains( "1" ) ); assertTrue( cachedResources.contains( "2" ) ); assertTrue( cachedResources.contains( "3" ) ); final List<String> networkResources = descriptor1.getNetworkResources(); assertEquals( networkResources.size(), 3 ); assertTrue( networkResources.contains( "A" ) ); assertTrue( networkResources.contains( "B" ) ); assertTrue( networkResources.contains( "C" ) ); final Map<String, String> fallbackResources = descriptor1.getFallbackResources(); assertEquals( fallbackResources.size(), 4 ); assertEquals( fallbackResources.get( "W" ), "W2" ); assertEquals( fallbackResources.get( "X" ), "X3" ); assertEquals( fallbackResources.get( "Y" ), "Y2" ); assertEquals( fallbackResources.get( "Z" ), "Z2" ); }
public void merge( @Nonnull final ManifestDescriptor other ) { for ( final String resource : other.getCachedResources() ) { if ( !_cachedResources.contains( resource ) ) { _cachedResources.add( resource ); } } for ( final String resource : other.getNetworkResources() ) { if ( !_networkResources.contains( resource ) ) { _networkResources.add( resource ); } } _fallbackResources.putAll( other.getFallbackResources() ); }
ManifestDescriptor { public void merge( @Nonnull final ManifestDescriptor other ) { for ( final String resource : other.getCachedResources() ) { if ( !_cachedResources.contains( resource ) ) { _cachedResources.add( resource ); } } for ( final String resource : other.getNetworkResources() ) { if ( !_networkResources.contains( resource ) ) { _networkResources.add( resource ); } } _fallbackResources.putAll( other.getFallbackResources() ); } }
ManifestDescriptor { public void merge( @Nonnull final ManifestDescriptor other ) { for ( final String resource : other.getCachedResources() ) { if ( !_cachedResources.contains( resource ) ) { _cachedResources.add( resource ); } } for ( final String resource : other.getNetworkResources() ) { if ( !_networkResources.contains( resource ) ) { _networkResources.add( resource ); } } _fallbackResources.putAll( other.getFallbackResources() ); }  }
ManifestDescriptor { public void merge( @Nonnull final ManifestDescriptor other ) { for ( final String resource : other.getCachedResources() ) { if ( !_cachedResources.contains( resource ) ) { _cachedResources.add( resource ); } } for ( final String resource : other.getNetworkResources() ) { if ( !_networkResources.contains( resource ) ) { _networkResources.add( resource ); } } _fallbackResources.putAll( other.getFallbackResources() ); }  @Nonnull List<String> getCachedResources(); @Nonnull List<String> getNetworkResources(); @Nonnull Map<String, String> getFallbackResources(); void merge( @Nonnull final ManifestDescriptor other ); @Override String toString(); static ManifestDescriptor parse( final String manifest ); }
ManifestDescriptor { public void merge( @Nonnull final ManifestDescriptor other ) { for ( final String resource : other.getCachedResources() ) { if ( !_cachedResources.contains( resource ) ) { _cachedResources.add( resource ); } } for ( final String resource : other.getNetworkResources() ) { if ( !_networkResources.contains( resource ) ) { _networkResources.add( resource ); } } _fallbackResources.putAll( other.getFallbackResources() ); }  @Nonnull List<String> getCachedResources(); @Nonnull List<String> getNetworkResources(); @Nonnull Map<String, String> getFallbackResources(); void merge( @Nonnull final ManifestDescriptor other ); @Override String toString(); static ManifestDescriptor parse( final String manifest );  }