Skip to content

Commit

Permalink
add file cleanup to test
Browse files Browse the repository at this point in the history
  • Loading branch information
apriltuesday committed Jun 20, 2024
1 parent 01aec6a commit 95dfa93
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public class CreateSeveralIntervalsOfSubsnpAccessionsJobConfigurationTest {

@Before
public void setUp() throws Exception {
this.cleanSlate();
mongoTemplate.dropCollection(SubmittedVariantEntity.class);
mockServer = MockRestServiceServer.createServer(restTemplate);
mockServer.expect(ExpectedCount.manyTimes(), requestTo(new URI(countServiceParameters.getUrl() + URL_PATH_SAVE_COUNT)))
Expand All @@ -109,12 +110,15 @@ public void setUp() throws Exception {

@After
public void tearDown() throws Exception {
this.cleanSlate();
mongoTemplate.dropCollection(SubmittedVariantEntity.class);
}

public void cleanSlate() throws Exception {
Files.deleteIfExists(Paths.get(inputParameters.getOutputVcf()));
Files.deleteIfExists(Paths.get(inputParameters.getOutputVcf() + AccessionReportWriter.VARIANTS_FILE_SUFFIX));
Files.deleteIfExists(Paths.get(inputParameters.getOutputVcf() + AccessionReportWriter.CONTIGS_FILE_SUFFIX));
Files.deleteIfExists(Paths.get(inputParameters.getOutputVcf()));
Files.deleteIfExists(Paths.get(inputParameters.getFasta() + ".fai"));
mongoTemplate.dropCollection(SubmittedVariantEntity.class);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public class CreateSubsnpAccessionsJobConfigurationTest {

@Before
public void setUp() throws Exception {
this.cleanSlate();
mongoTemplate.dropCollection(SubmittedVariantEntity.class);
mockServer = MockRestServiceServer.createServer(restTemplate);
mockServer.expect(ExpectedCount.manyTimes(), requestTo(new URI(countServiceParameters.getUrl() + URL_PATH_SAVE_COUNT)))
Expand All @@ -108,11 +109,15 @@ public void setUp() throws Exception {

@After
public void tearDown() throws Exception {
this.cleanSlate();
mongoTemplate.dropCollection(SubmittedVariantEntity.class);
}

public void cleanSlate() throws Exception {
Files.deleteIfExists(Paths.get(inputParameters.getOutputVcf()));
Files.deleteIfExists(Paths.get(inputParameters.getOutputVcf() + AccessionReportWriter.VARIANTS_FILE_SUFFIX));
Files.deleteIfExists(Paths.get(inputParameters.getOutputVcf() + AccessionReportWriter.CONTIGS_FILE_SUFFIX));
Files.deleteIfExists(Paths.get(inputParameters.getFasta() + ".fai"));
mongoTemplate.dropCollection(SubmittedVariantEntity.class);
}

@Test
Expand Down

0 comments on commit 95dfa93

Please sign in to comment.