Skip to content
This repository was archived by the owner on Dec 5, 2022. It is now read-only.

Commit eb0d9cc

Browse files
committed
writing test data to temp directory
1 parent 38d1b66 commit eb0d9cc

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

beam-bigtiff/src/test/java/org/esa/beam/dataio/bigtiff/BigGeoTiffWriteReadTest.java

+6-8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import java.awt.geom.AffineTransform;
4949
import java.io.File;
5050
import java.io.IOException;
51+
import java.nio.file.Files;
5152

5253
import static org.junit.Assert.*;
5354

@@ -62,16 +63,13 @@ public class BigGeoTiffWriteReadTest {
6263
private static final String LAMBERT_CONIC_CONFORMAL_1SP = "EPSG:9801";
6364
private static final String ALBERS_CONIC_EQUAL_AREA = "Albers_Conic_Equal_Area";
6465

65-
private final static File TEST_DIR = new File("test_data");
66-
66+
private File testDataDir;
6767
private Product outProduct;
6868
private File location;
6969

7070
@Before
71-
public void setup() {
72-
if (!TEST_DIR.mkdirs()) {
73-
fail("unable to create test directory");
74-
}
71+
public void setup() throws IOException {
72+
testDataDir = Files.createTempDirectory("test_data").toFile();
7573
final int width = 14;
7674
final int height = 14;
7775
outProduct = new Product("P", "T", width, height);
@@ -82,7 +80,7 @@ public void setup() {
8280

8381
@After
8482
public void tearDown() {
85-
if (!FileUtils.deleteTree(TEST_DIR)) {
83+
if (!FileUtils.deleteTree(testDataDir)) {
8684
fail("unable to delete test directory");
8785
}
8886
}
@@ -565,7 +563,7 @@ private static void setTiePointGeoCoding(final Product product) {
565563
}
566564

567565
private Product writeReadProduct() throws IOException {
568-
location = new File(TEST_DIR, "test_product.tif");
566+
location = new File(testDataDir, "test_product.tif");
569567

570568
final String bigGeoTiffFormatName = "BigGeoTiff";
571569
ProductIO.writeProduct(outProduct, location.getAbsolutePath(), bigGeoTiffFormatName);

0 commit comments

Comments
 (0)