Код: Выделить всё
public class FooTest {
private FileSystem fs = Jimfs.newFileSystem(Configuration.unix());
private List
paths = new ArrayList();
private Path getPath(String first, String... more) {
Path path = fs.getPath(first, more);
paths.add(path);
return path;
}
@After public void cleanPaths() {
for (Path path: paths) {
Files.walkFileTree(path, FileVisitors.DELETE);
}
}
@Test public void bar() {
Path baz = getPath("baz");
// test using baz
}
}
Я явно думаю, что это основная потребность, почему jimfs был создан, но что ж... Я адаптирую существующий код и внезапно запутался в этом.
Подробнее здесь: https://stackoverflow.com/questions/335 ... -each-test
Мобильная версия