Changeset 5099


Ignore:
Timestamp:
04/30/14 08:16:55 (10 years ago)
Author:
Twan Goosen
Message:

Using TemporaryFolder? rule in importer tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vlo/trunk/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/ImporterTestcase.java

    r5098 r5099  
    99import org.junit.After;
    1010import org.junit.Before;
     11import org.junit.Rule;
     12import org.junit.rules.TemporaryFolder;
    1113
    1214public abstract class ImporterTestcase {
     
    1416    private final VloConfigFactory configFactory = new DefaultVloConfigFactory();
    1517    protected VloConfig config;
     18
     19    @Rule
     20    public TemporaryFolder folder = new TemporaryFolder();
    1621    private File testDir;
    1722
     
    2429    @After
    2530    public void cleanup() {
    26         FileUtils.deleteQuietly(testDir);
    2731        MetadataImporter.config = null;
    2832    }
     
    3034    @Before
    3135    public void setup() throws Exception {
    32         final String baseTempPath = System.getProperty("java.io.tmpdir");
    33         testDir = new File(baseTempPath + File.separator + "testRegistry_" + System.currentTimeMillis());
    34         testDir.mkdir();
    35         testDir.deleteOnExit();
     36        testDir = folder.newFolder(String.format("vlo_%s_%d", getClass().getCanonicalName(), System.currentTimeMillis()));
    3637
    3738        // read the configuration defined in the packaged configuration file
     
    4041        // optionally, modify the configuration here
    4142        MetadataImporter.config.setComponentRegistryRESTURL("http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/");
    42         config = MetadataImporter.config;       
     43        config = MetadataImporter.config;
    4344    }
    4445
Note: See TracChangeset for help on using the changeset viewer.