initializing directory BeforeClass instead of Before
This commit is contained in:
@@ -15,22 +15,17 @@
|
||||
*/
|
||||
package org.springframework.integration.file.locking;
|
||||
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.integration.file.FileReadingMessageSource;
|
||||
import org.springframework.integration.test.matcher.PayloadMatcher;
|
||||
import static org.springframework.integration.test.matcher.PayloadMatcher.hasPayload;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.Test;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.Assert;
|
||||
import org.junit.matchers.JUnitMatchers;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -19,6 +19,7 @@ import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -30,13 +31,21 @@ import java.util.List;
|
||||
*/
|
||||
public class LockFileFileListFilterTests {
|
||||
|
||||
private File workdir = new File(new File(System.getProperty("java.io.tmpdir")), this.getClass().getSimpleName());;
|
||||
private static File workdir = new File(new File(System.getProperty("java.io.tmpdir")), LockFileFileListFilterTests.class.getSimpleName());
|
||||
|
||||
@BeforeClass
|
||||
public static void setupWorkDir() {
|
||||
workdir.mkdir();
|
||||
}
|
||||
|
||||
private FileLocker locker = new LockFileFileLocker(workdir);
|
||||
|
||||
@Before
|
||||
public void setupWorkDir() {
|
||||
workdir.mkdir();
|
||||
cleanDirectory(workdir);
|
||||
public void cleanDirectory() {
|
||||
File[] files = workdir.listFiles();
|
||||
for (File file : files) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -60,11 +69,4 @@ public class LockFileFileListFilterTests {
|
||||
assertThat(filter2.filterFiles(workdir.listFiles()), is((List)new ArrayList<File>()));
|
||||
}
|
||||
|
||||
private void cleanDirectory(File workdir) {
|
||||
File[] files = workdir.listFiles();
|
||||
for (File file : files) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user