### Question:
WrapperExecutor { public static WrapperExecutor forWrapperPropertiesFile( Path propertiesFile ) { if ( !Files.exists( propertiesFile ) ) { throw new RuntimeException( String.format( "Wrapper properties file '%s' does not exist.", propertiesFile ) ); } return new WrapperExecutor( propertiesFile, new Properties() ); } WrapperExecutor( Path propertiesFile, Properties properties ); static WrapperExecutor forProjectDirectory( Path projectDir ); static WrapperExecutor forWrapperPropertiesFile( Path propertiesFile ); URI getDistribution(); WrapperConfiguration getConfiguration(); void execute( String[] args, Installer install, BootstrapMainStarter bootstrapMainStarter ); static final String DISTRIBUTION_URL_PROPERTY; static final String DISTRIBUTION_BASE_PROPERTY; static final String ZIP_STORE_BASE_PROPERTY; static final String DISTRIBUTION_PATH_PROPERTY; static final String ZIP_STORE_PATH_PROPERTY; }### Answer:
@Test( ) public void failWhenDistNotSetInProperties() throws Exception { properties = new Properties(); writePropertiesFile( properties, propertiesFile, "header" ); try { WrapperExecutor.forWrapperPropertiesFile( propertiesFile ); Assert.fail( "Expected RuntimeException" ); } catch ( RuntimeException e ) { Assert.assertEquals( "No value with key 'distributionUrl' specified in wrapper properties file '" + propertiesFile + "'.", e.getMessage() ); } }
@Test public void failWhenPropertiesFileDoesNotExist() { propertiesFile = testDir.getRoot().toPath().resolve( "unknown.properties" ); try { WrapperExecutor.forWrapperPropertiesFile( propertiesFile ); Assert.fail( "Expected RuntimeException" ); } catch ( RuntimeException e ) { Assert.assertEquals( "Wrapper properties file '" + propertiesFile + "' does not exist.", e.getMessage() ); } }