@Test(dependsOnMethods = "testUploadWithMultipleProperties") public void testDownloadWithMatchingMandatoryProperties() throws IOException { // Property matches InputStream inputStream = artifactory.repository(localRepository.getKey()).download(PATH).withMandatoryProperty("colors", "red").doDownload(); assertEquals(textFrom(inputStream), textFrom(this.getClass().getResourceAsStream("/sample.txt"))); }
@Test(dependsOnMethods = "testUploadWithMultipleProperties", expectedExceptions = IOException.class) public void testDownloadWithNonExistingMandatoryProperties() throws IOException { // Property doesn't exist, will fail artifactory.repository(localRepository.getKey()).download(PATH).withMandatoryProperty("foo", "bar").doDownload(); }
@Test(dependsOnMethods = "testUploadWithMultipleProperties", expectedExceptions = HttpResponseException.class) public void testDownloadWithWrongMandatoryProperties() throws IOException { // Property doesn't match, will fail artifactory.repository(localRepository.getKey()).download(PATH).withMandatoryProperty("colors", "black").doDownload(); }
@Test(dependsOnMethods = "testUploadWithMultipleProperties") public void testDownloadWithMandatoryAndNonMandatoryProperties() throws IOException { InputStream inputStream = artifactory.repository(localRepository.getKey()).download(PATH).withProperty("released", false) .withProperty("foo", "bar").withMandatoryProperty("colors", "red").doDownload(); assertEquals(textFrom(inputStream), textFrom(this.getClass().getResourceAsStream("/sample.txt"))); } }