@@ -297,7 +297,7 @@ public void checkAssertion() {
297
297
298
298
@ Test
299
299
public void shouldInitTempDirectory () throws Exception {
300
- File basePath = getTempDir ();
300
+ File basePath = TestUtil . getTempDir ();
301
301
Migrator .main (TestUtil .args ("--path=" + basePath .getAbsolutePath (), "init" ));
302
302
assertNotNull (basePath .list ());
303
303
assertEquals (4 , basePath .list ().length );
@@ -310,7 +310,7 @@ public void shouldInitTempDirectory() throws Exception {
310
310
@ Test
311
311
public void shouldRespectIdPattern () throws Exception {
312
312
String idPattern = "000" ;
313
- File basePath = getTempDir ();
313
+ File basePath = TestUtil . getTempDir ();
314
314
Migrator .main (TestUtil .args ("--path=" + basePath .getAbsolutePath (), "--idpattern=" + idPattern , "init" ));
315
315
File changelog = new File (
316
316
basePath .getCanonicalPath () + File .separator + "scripts" + File .separator + "001_create_changelog.sql" );
@@ -325,7 +325,7 @@ public void shouldRespectIdPattern() throws Exception {
325
325
@ Test
326
326
public void useCustomTemplate () throws Exception {
327
327
String desc = "test new migration" ;
328
- File basePath = getTempDir ();
328
+ File basePath = TestUtil . getTempDir ();
329
329
Migrator .main (TestUtil .args ("--path=" + basePath .getAbsolutePath (), "init" ));
330
330
assertNotNull (basePath .list ());
331
331
assertEquals (4 , basePath .list ().length );
@@ -351,7 +351,7 @@ public void useCustomTemplate() throws Exception {
351
351
352
352
@ Test
353
353
public void useCustomTemplateWithNoValue () throws Exception {
354
- File basePath = getTempDir ();
354
+ File basePath = TestUtil . getTempDir ();
355
355
Migrator .main (TestUtil .args ("--path=" + basePath .getAbsolutePath (), "init" ));
356
356
assertNotNull (basePath .list ());
357
357
assertEquals (4 , basePath .list ().length );
@@ -368,7 +368,7 @@ public void useCustomTemplateWithNoValue() throws Exception {
368
368
@ Test
369
369
public void useCustomTemplateWithBadPath () throws Exception {
370
370
System .setProperty ("migrationsHome" , "/tmp" );
371
- File basePath = getTempDir ();
371
+ File basePath = TestUtil . getTempDir ();
372
372
Migrator .main (TestUtil .args ("--path=" + basePath .getAbsolutePath (), "init" ));
373
373
assertNotNull (basePath .list ());
374
374
assertEquals (4 , basePath .list ().length );
@@ -386,7 +386,7 @@ public void useCustomTemplateWithBadPath() throws Exception {
386
386
@ Test
387
387
public void shouldSuppressOutputIfQuietOptionEnabled () throws Throwable {
388
388
System .setProperty ("migrationsHome" , "/tmp" );
389
- File basePath = getTempDir ();
389
+ File basePath = TestUtil . getTempDir ();
390
390
out .clearLog ();
391
391
Migrator .main (TestUtil .args ("--path=" + basePath .getAbsolutePath (), "--quiet" , "init" ));
392
392
String output = out .getLog ();
@@ -397,7 +397,7 @@ public void shouldSuppressOutputIfQuietOptionEnabled() throws Throwable {
397
397
@ Test
398
398
public void shouldColorizeSuccessOutputIfColorOptionEnabled () throws Throwable {
399
399
System .setProperty ("migrationsHome" , "/tmp" );
400
- File basePath = getTempDir ();
400
+ File basePath = TestUtil . getTempDir ();
401
401
out .clearLog ();
402
402
Migrator .main (TestUtil .args ("--path=" + basePath .getAbsolutePath (), "--color" , "init" ));
403
403
String output = out .getLog ();
@@ -415,18 +415,8 @@ public void checkAssertion() {
415
415
}
416
416
});
417
417
System .setProperty ("migrationsHome" , "/tmp" );
418
- File basePath = getTempDir ();
418
+ File basePath = TestUtil . getTempDir ();
419
419
out .clearLog ();
420
420
Migrator .main (TestUtil .args ("--path=" + basePath .getAbsolutePath (), "--color" , "new" ));
421
421
}
422
-
423
- private File getTempDir () throws IOException {
424
- File f = File .createTempFile ("migration" , "test" );
425
- assertTrue (f .delete ());
426
- assertTrue (f .mkdir ());
427
- assertTrue (f .exists ());
428
- assertTrue (f .isDirectory ());
429
- f .deleteOnExit ();
430
- return f ;
431
- }
432
422
}
0 commit comments