@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"))); } }
@Test(dependsOnMethods = "testUploadWithMultipleProperties") public void testDownloadWithMatchingNonMandatoryProperties() throws IOException { //property matches InputStream inputStream = artifactory.repository(localRepository.getKey()).download(PATH).withProperty("colors", "red") .doDownload(); assertEquals(textFrom(inputStream), textFrom(this.getClass().getResourceAsStream("/sample.txt"))); }
@Test(dependsOnMethods = "testUploadWithMultipleProperties") public void testDownloadWithNonExistingNonMandatoryProperties() throws IOException { //property doesn't exist InputStream inputStream = artifactory.repository(localRepository.getKey()).download(PATH).withProperty("foo", "bar").doDownload(); assertEquals(textFrom(inputStream), textFrom(this.getClass().getResourceAsStream("/sample.txt"))); }
@Test(dependsOnMethods = "testUploadWithMultipleProperties", expectedExceptions = HttpResponseException.class) public void testDownloadWithWrongNonMandatoryProperties() throws IOException { //property doesn't match, will fail artifactory.repository(localRepository.getKey()).download(PATH).withProperty("colors", "black").doDownload(); }