### Question:
PackageRegistry { public JavaPackage getPackageById( String id ) { if ( id == null || id.equals( "__default" ) ) id = ""; if ( id.equals( "__noinstall" ) ) return null; JavaPackage pkg = packages.get( id ); if ( pkg == null ) { pkg = new JavaPackage( id, getMetadataFilePath( id ) ); packages.put( id, pkg ); } return pkg; } PackageRegistry( InstallerSettings settings, String basePackageName ); JavaPackage getPackageById( String id ); Set<JavaPackage> getPackages();  }### Answer:
@Test public void testNonDefault() throws Exception { JavaPackage pkg = registry.getPackageById( "subpackage" ); Set<File> files = pkg.getFiles(); assertEquals( 1, files.size() ); File metadataFile = files.iterator().next(); assertEquals( Paths.get( "usr/share/maven-metadata/test-package-subpackage.xml" ), metadataFile.getTargetPath() ); }
@Test public void testMetadata() throws Exception { JavaPackage pkg = registry.getPackageById( null ); Set<File> files = pkg.getFiles(); assertEquals( 1, files.size() ); File metadataFile = files.iterator().next(); assertEquals( Paths.get( "usr/share/maven-metadata/test-package.xml" ), metadataFile.getTargetPath() ); assertNotNull( pkg.getMetadata() ); }