### Question:
UrlTransformer implements ArtifactUrlTransformer { @Override public boolean canHandle( File file ) { if ( !file.exists() ) { return false; } if ( this.isTarGzFile( file ) ) { return canHandleTarGzFile( file ); } else if ( this.isZipFile( file ) ) { return canHandleZipFile( file ); } return false; }  @Override URL transform( URL url ); @Override boolean canHandle( File file );  }### Answer:
@Test public void canHandleTgzFileWithPackageJson() throws Exception { assertTrue( this.transformer.canHandle( getResourceFile( "/my-simple-module-1.4.0.tgz" ) ) ); }
@Test public void canHandleZipFileWithPackageJson() throws Exception { assertTrue( this.transformer.canHandle( getResourceFile( "/my-simple-module-1.4.0.zip" ) ) ); }
@Test public void canHandleJarFileWithPackageJsonButNoManifest() throws Exception { assertTrue( this.transformer.canHandle( getResourceFile( "/my-simple-module-1.4.0.jar" ) ) ); }
@Test public void cannotHandleTgzFileWithNoPackageJson() throws Exception { assertFalse( this.transformer.canHandle( getResourceFile( "/no-package-json.tgz" ) ) ); }
@Test public void cannotHandleZipFileWithNoPackageJson() throws Exception { assertFalse( this.transformer.canHandle( getResourceFile( "/no-package-json.zip" ) ) ); }
@Test public void cannotHandleJarFileWithNoPackageJson() throws Exception { assertFalse( this.transformer.canHandle( getResourceFile( "/no-package-json.jar" ) ) ); }
@Test public void cannotHandleJarFileWithPackageJsonButWithManifest() throws Exception { assertFalse( this.transformer.canHandle( getResourceFile( "/with-manifest.jar" ) ) ); }
@Test public void cannotHandleInexistentFile() throws Exception { assertFalse( this.transformer.canHandle( new File( "/not-there.zip" ) ) ); }
@Test public void cannotHandleOtherFiles() throws Exception { assertFalse( this.transformer.canHandle( getResourceFile( "/package.json" ) ) ); }
@Test public void cannotHandleInvalidTgzFile() throws Exception { assertFalse( this.transformer.canHandle( getResourceFile( "/invalid.tgz" ) ) ); }
@Test public void cannotHandleInvalidZipFile() throws Exception { assertFalse( this.transformer.canHandle( getResourceFile( "/invalid.zip" ) ) ); }