### Question:
LocationResolverChain { public LocationResolver getLocationResolver(BuildahConfiguration buildahConfiguration) { final String buildahBinary = this.operatingSystemConfig.resolveBinary(BUILDAH_BINARY_FORMAT); final String runcBinary = this.operatingSystemConfig.resolveBinary(RUNC_BINARY_FORMAT); if (System.getProperty(BUILDAH_VERSION) != null && System.getProperty(RUNC_VERSION) != null) { return getUrlLocationResolver(buildahBinary, System.getProperty(BUILDAH_VERSION), runcBinary, System.getProperty(RUNC_VERSION)); } if (buildahConfiguration.isBuildahVersionSet() && buildahConfiguration.isRuncVersionSet()) { return getUrlLocationResolver(buildahBinary, buildahConfiguration.getBuildahVersion(), runcBinary, buildahConfiguration.getRuncVersion()); } return getClasspathLocationResolver(buildahBinary, runcBinary); } LocationResolverChain(); LocationResolver getLocationResolver(BuildahConfiguration buildahConfiguration);  }### Answer:
@Test public void should_use_classpath_locator_by_default() { final LocationResolverChain locationResolverChain = new LocationResolverChain(); final LocationResolver locationResolver = locationResolverChain.getLocationResolver(new BuildahConfiguration()); assertThat(locationResolver) .isInstanceOf(ClasspathLocationResolver.class); }
@Test public void should_use_url_locator_if_version_set() { final LocationResolverChain locationResolverChain = new LocationResolverChain(); final BuildahConfiguration buildahConfiguration = new BuildahConfiguration(); buildahConfiguration.setBuildahVersion("0.0.19"); buildahConfiguration.setRuncVersion("0.0.19"); final LocationResolver locationResolver = locationResolverChain.getLocationResolver(buildahConfiguration); assertThat(locationResolver) .isInstanceOf(UrlLocationResolver.class); }
@Test public void should_use_url_locator_if_version_system_property_set() { final LocationResolverChain locationResolverChain = new LocationResolverChain(); System.setProperty(LocationResolverChain.BUILDAH_VERSION, "0.0.19"); System.setProperty(LocationResolverChain.RUNC_VERSION, "0.0.19"); final BuildahConfiguration buildahConfiguration = new BuildahConfiguration(); final LocationResolver locationResolver = locationResolverChain.getLocationResolver(buildahConfiguration); assertThat(locationResolver) .isInstanceOf(UrlLocationResolver.class); }