48
48
import java .awt .geom .AffineTransform ;
49
49
import java .io .File ;
50
50
import java .io .IOException ;
51
+ import java .nio .file .Files ;
51
52
52
53
import static org .junit .Assert .*;
53
54
@@ -62,16 +63,13 @@ public class BigGeoTiffWriteReadTest {
62
63
private static final String LAMBERT_CONIC_CONFORMAL_1SP = "EPSG:9801" ;
63
64
private static final String ALBERS_CONIC_EQUAL_AREA = "Albers_Conic_Equal_Area" ;
64
65
65
- private final static File TEST_DIR = new File ("test_data" );
66
-
66
+ private File testDataDir ;
67
67
private Product outProduct ;
68
68
private File location ;
69
69
70
70
@ 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 ();
75
73
final int width = 14 ;
76
74
final int height = 14 ;
77
75
outProduct = new Product ("P" , "T" , width , height );
@@ -82,7 +80,7 @@ public void setup() {
82
80
83
81
@ After
84
82
public void tearDown () {
85
- if (!FileUtils .deleteTree (TEST_DIR )) {
83
+ if (!FileUtils .deleteTree (testDataDir )) {
86
84
fail ("unable to delete test directory" );
87
85
}
88
86
}
@@ -565,7 +563,7 @@ private static void setTiePointGeoCoding(final Product product) {
565
563
}
566
564
567
565
private Product writeReadProduct () throws IOException {
568
- location = new File (TEST_DIR , "test_product.tif" );
566
+ location = new File (testDataDir , "test_product.tif" );
569
567
570
568
final String bigGeoTiffFormatName = "BigGeoTiff" ;
571
569
ProductIO .writeProduct (outProduct , location .getAbsolutePath (), bigGeoTiffFormatName );
0 commit comments