本文整理汇总了Java中org.junit.rules.TemporaryFolder.delete方法的典型用法代码示例。如果您正苦于以下问题:Java TemporaryFolder.delete方法的具体用法?Java TemporaryFolder.delete怎么用?Java TemporaryFolder.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.junit.rules.TemporaryFolder
的用法示例。
在下文中一共展示了TemporaryFolder.delete方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test0
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
public void test0(){
if (System.getenv().get("SKIP_HEAVY")!=null){
return;
}
TemporaryFolder tempSwaggerApis=new TemporaryFolder();
TemporaryFolder tempRAMLApis=new TemporaryFolder();
try{
File fs=File.createTempFile("ddd", "tmp");
FileUtils.copyInputStreamToFile(RegistryManager.getInstance().getClass().getResourceAsStream("/azure-specs.zip"), fs);
tempSwaggerApis.create();
tempRAMLApis.create();
extractFolder(fs.getAbsolutePath(), tempSwaggerApis.getRoot().getAbsolutePath());
WriteApis.write(tempSwaggerApis.getRoot().getAbsolutePath(), tempRAMLApis.getRoot().getAbsolutePath());
tempSwaggerApis.delete();
tempRAMLApis.delete();
}catch (Exception e) {
throw new IllegalStateException();
}
}
示例2: test0
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
public void test0() {
if (System.getenv().get("SKIP_HEAVY")!=null){
return;
}
TemporaryFolder temporaryFolder = new TemporaryFolder();
try {
temporaryFolder.create();
Converter converter = new Converter(temporaryFolder.getRoot().getAbsolutePath());
converter.get();
TestCase.assertTrue(converter.getSucccessCount()>=129);
temporaryFolder.delete();
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
示例3: compile
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
default List<IMessage> compile(final Class<?>... classes) throws IOException {
final TemporaryFolder temporaryFolder = new TemporaryFolder();
temporaryFolder.create();
try {
final List<String> arguments = new ArrayList<>();
arguments.add("-source");
arguments.add("1.8");
arguments.add("-target");
arguments.add("1.8");
arguments.add("-cp");
arguments.add(System.getProperty("java.class.path"));
arguments.add("-aspectpath");
arguments.add("target/classes");
arguments.add("-d");
arguments.add(temporaryFolder.newFolder().getAbsolutePath());
asList(classes).stream()
.map(Class::getName)
.map(n -> n.replace('.', '/'))
.map(n -> format("src/test/java/%s.java", n))
.forEach(arguments::add);
final Main compiler = new Main();
final MessageHandler handler = new MessageHandler();
compiler.run(toArray(arguments, String.class), handler);
return asList(handler.getMessages(null, true))
.stream()
.filter(IMessage::isError)
.collect(toList());
} finally {
temporaryFolder.delete();
}
}
示例4: recursiveDeleteFolderWithOneElement
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Test
public void recursiveDeleteFolderWithOneElement() throws IOException {
TemporaryFolder folder = new TemporaryFolder();
folder.create();
File file = folder.newFile("a");
folder.delete();
assertFalse(file.exists());
assertFalse(folder.getRoot().exists());
}
示例5: recursiveDeleteFolderWithOneRandomElement
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Test
public void recursiveDeleteFolderWithOneRandomElement() throws IOException {
TemporaryFolder folder = new TemporaryFolder();
folder.create();
File file = folder.newFile();
folder.delete();
assertFalse(file.exists());
assertFalse(folder.getRoot().exists());
}
示例6: recursiveDeleteFolderWithZeroElements
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Test
public void recursiveDeleteFolderWithZeroElements() throws IOException {
TemporaryFolder folder = new TemporaryFolder();
folder.create();
folder.delete();
assertFalse(folder.getRoot().exists());
}
示例7: sanitizeSymlinkedWorkingDirectory
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Test
public void sanitizeSymlinkedWorkingDirectory() throws InterruptedException, IOException {
TemporaryFolder folder = new TemporaryFolder();
folder.create();
ProjectFilesystem filesystem =
TestProjectFilesystems.createProjectFilesystem(folder.getRoot().toPath());
// Setup up a symlink to our working directory.
Path symlinkedRoot = folder.getRoot().toPath().resolve("symlinked-root");
java.nio.file.Files.createSymbolicLink(symlinkedRoot, tmp.getRoot());
// Run the build, setting PWD to the above symlink. Typically, this causes compilers to use
// the symlinked directory, even though it's not the right project root.
BuildTarget target = BuildTargetFactory.newInstance("//:simple#default,static");
workspace
.runBuckCommandWithEnvironmentOverridesAndContext(
tmp.getRoot(),
Optional.empty(),
ImmutableMap.of("PWD", symlinkedRoot.toString()),
"build",
target.getFullyQualifiedName())
.assertSuccess();
// Verify that we still sanitized this path correctly.
Path lib = workspace.getPath(BuildTargets.getGenPath(filesystem, target, "%s/libsimple.a"));
String contents = Files.asByteSource(lib.toFile()).asCharSource(Charsets.ISO_8859_1).read();
assertFalse(lib.toString(), contents.contains(tmp.getRoot().toString()));
assertFalse(lib.toString(), contents.contains(symlinkedRoot.toString()));
folder.delete();
}
示例8: tearDown
import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Override
protected void tearDown() throws Exception {
for (TemporaryFolder f:folders){
f.delete();
}
}