@@ -3,18 +3,16 @@ package geoscript
33import geoscript.feature.Feature
44import geoscript.feature.Schema
55import geoscript.filter.Expression
6- import geoscript.geom.Point
76import geoscript.layer.Cursor
87import geoscript.proj.Geodetic
98import geoscript.layer.Format
109import geoscript.layer.GeoTIFF
1110import geoscript.layer.Raster
1211import geoscript.workspace.Memory
13- import org.junit.Rule
14- import org.junit.Test
15- import org.junit.rules.TemporaryFolder
12+ import org.junit.jupiter.api.Test
13+ import org.junit.jupiter.api.io.TempDir
1614
17- import static org.junit.Assert .*
15+ import static org.junit.jupiter.api.Assertions .*
1816
1917import geoscript.geom.*
2018import geoscript.layer.Layer
@@ -26,10 +24,10 @@ import geoscript.workspace.Workspace
2624 * The unit test for the GeoScript class.
2725 * @author Jared Erickson
2826 */
29- class GeoScriptTestCase {
27+ class GeoScriptTest {
3028
31- @Rule
32- public TemporaryFolder folder = new TemporaryFolder ()
29+ @TempDir
30+ private File folder
3331
3432 @Test void wrap () {
3533 assertTrue GeoScript . wrap(new Feature ([the_geom : " POINT (1 1)" ]," pt" ). f) instanceof Feature
@@ -151,7 +149,7 @@ class GeoScriptTestCase {
151149"POINT (111 -47)","House","12.5"
152150"POINT (121 -45)","School","22.7"
153151"""
154- File csvFile = folder . newFile( " layer.csv" )
152+ File csvFile = new File (folder, " layer.csv" )
155153 csvFile. write(csv)
156154 use(GeoScript ) {
157155 Layer layer = csvFile as Layer
@@ -165,7 +163,7 @@ class GeoScriptTestCase {
165163
166164 @Test void geoJsonFileAsLayer () {
167165 String json = """ {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[111,-47]},"properties":{"name":"House","price":12.5},"id":"fid-3eff7fce_131b538ad4c_-8000"},{"type":"Feature","geometry":{"type":"Point","coordinates":[121,-45]},"properties":{"name":"School","price":22.7},"id":"fid-3eff7fce_131b538ad4c_-7fff"}]}"""
168- File jsonFile = folder . newFile( " layer.json" )
166+ File jsonFile = new File (folder, " layer.json" )
169167 jsonFile. write(json)
170168 use(GeoScript ) {
171169 Layer layer = jsonFile as Layer
@@ -235,17 +233,17 @@ class GeoScriptTestCase {
235233 }
236234
237235 @Test void zipUnzip () {
238- File dir = folder . newFolder( " files" )
236+ File dir = FileUtil . createDir(folder, " files" )
239237 List files = [" file1" ," file2" ," file3" ]. collect {
240238 File file = new File (dir, " ${ it} .txt" )
241239 file. write(" 123" )
242240 file
243241 }
244- File zipFile = folder . newFile( " files.zip" )
242+ File zipFile = new File (folder, " files.zip" )
245243 GeoScript . zip(files, zipFile)
246244 assertTrue zipFile. exists()
247245 assertTrue zipFile. length() > 0
248- File newDir = folder . newFolder( " unzipped" )
246+ File newDir = FileUtil . createDir(folder, " unzipped" )
249247 GeoScript . unzip(zipFile, newDir)
250248 [" file1" ," file2" ," file3" ]. each { String name ->
251249 File f = new File (newDir, " ${ name} .txt" )
@@ -256,7 +254,7 @@ class GeoScriptTestCase {
256254
257255 @Test void download () {
258256 URL url = getClass(). getClassLoader(). getResource(" points.zip" )
259- File file = folder . newFile( " zipped_points" )
257+ File file = new File (folder, " zipped_points" )
260258 GeoScript . download(url, file)
261259 assertTrue file. exists()
262260 assertTrue file. length() > 100
0 commit comments