Skip to content

Commit

Permalink
test(report): Fix file initialization (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
Janelle Law committed Aug 6, 2021
1 parent 6eeb85c commit 7f73beb
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/test/java/itest/ReportIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,12 @@ public class ReportIT extends StandardSelfTest {
String.format("/api/v1/targets/%s/recordings", SELF_REFERENCE_TARGET_ID);
static final String ARCHIVE_REQ_URL = "/api/v1/recordings";
static final String TEMP_REPORT = "src/test/resources/reportTest.html";
static File file;
static Document doc;

@Test
void testGetReportShouldSendFile() throws Exception {

CompletableFuture<String> savedRecordingName = new CompletableFuture<>();
File file = new File(TEMP_REPORT);

try {
// Create a recording
Expand Down Expand Up @@ -133,16 +132,14 @@ void testGetReportShouldSendFile() throws Exception {
}
});

file = new File(TEMP_REPORT);

try (FileOutputStream fos = new FileOutputStream(file);
BufferedOutputStream bos = new BufferedOutputStream(fos)) {

byte[] bytes = getResponse.get().getBytes();
bos.write(bytes);
}

doc = Jsoup.parse(file, "UTF-8");
Document doc = Jsoup.parse(file, "UTF-8");

MatcherAssert.assertThat(file.length(), Matchers.greaterThan(0L));

Expand Down

0 comments on commit 7f73beb

Please sign in to comment.