Skip to content

Commit

Permalink
Merge pull request #180 from jtnord/close-stream
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreBtz authored Feb 23, 2023
2 parents 78a23dc + 22c441f commit 3ce35b0
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.concurrent.TimeUnit;

import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.cloudbees.jenkins.plugins.advisor.BundleUpload.BUNDLE_SUCCESSFULLY_UPLOADED;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.any;
Expand All @@ -30,6 +32,7 @@
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static java.lang.String.format;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertFalse;
Expand Down Expand Up @@ -80,7 +83,9 @@ public void execute() throws Exception {
// Refresh the configuration?
assertThat(config.getLastBundleResult(), containsString(BUNDLE_SUCCESSFULLY_UPLOADED));

assertThat(Files.list(Paths.get(BundleUpload.TEMP_BUNDLE_DIRECTORY)).count(), is(equalTo(0L)));
try (Stream<Path> children = Files.list(Paths.get(BundleUpload.TEMP_BUNDLE_DIRECTORY))) {
assertThat(children.collect(Collectors.toList()), is(empty()));
}
}

@Test
Expand Down

0 comments on commit 3ce35b0

Please sign in to comment.