当前位置: 首页>>代码示例>>Java>>正文


Java TemporaryFolder.getRoot方法代码示例

本文整理汇总了Java中org.junit.rules.TemporaryFolder.getRoot方法的典型用法代码示例。如果您正苦于以下问题:Java TemporaryFolder.getRoot方法的具体用法?Java TemporaryFolder.getRoot怎么用?Java TemporaryFolder.getRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.junit.rules.TemporaryFolder的用法示例。


在下文中一共展示了TemporaryFolder.getRoot方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: copyTestFile

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
public static File copyTestFile(String source, TemporaryFolder root, String target) {
    File targetFile = new File(root.getRoot(), target);
    targetFile.getParentFile().mkdirs();
    try (OutputStream stream = new FileOutputStream(targetFile)) {
        Resources.copy(WhoCalled.$.getCallingClass().getResource(source), stream);
        return targetFile;
    } catch (IOException e) {
        throw new AssertionError(e);
    }
}
 
开发者ID:palantir,项目名称:gradle-circle-style,代码行数:11,代码来源:TestCommon.java

示例2: setupTest

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@Before
public void setupTest() throws IOException {
	TemporaryFolder f = new TemporaryFolder();
	f.create();
	_temp_folder = f.getRoot();
	System.out.println("created temporary folder: " + _temp_folder.getAbsolutePath());
}
 
开发者ID:tudarmstadt-lt,项目名称:topicrawler,代码行数:8,代码来源:LanguageModelTest.java

示例3: init

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
@BeforeClass
public static void init() throws IOException {
	TemporaryFolder f = new TemporaryFolder();
	f.create();
	File temp_folder = f.getRoot();
	System.out.println("created temporary folder: " + temp_folder.getAbsolutePath());


	UURI uuri = UURIFactory.getInstance("http://localtest/test");
	curi = new CrawlURI(uuri);
	l = new DecesiveValueLogger2();
	l.setPath(new ConfigPath("test", temp_folder.getAbsolutePath()));
	l.start();
}
 
开发者ID:tudarmstadt-lt,项目名称:topicrawler,代码行数:15,代码来源:DecesiveLoggerTest.java

示例4: getRandomFile

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
public static File getRandomFile(final int length, final String extension, final TemporaryFolder tempFolder)
{
	try
	{
		return tempFolder.newFile( String.format( "%s%s", HeadlessTestUtility.getRandomString( length ),
												  extension ) );
	}
	catch( final IOException ignored )
	{
		// do nothing
	}
	return tempFolder.getRoot();
}
 
开发者ID:GitHubRGI,项目名称:swagd,代码行数:14,代码来源:HeadlessTestUtility.java

示例5: createScript

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
private static File createScript(TemporaryFolder baseDir, String[] lines) throws IOException {
    File directory = baseDir.getRoot();
    Files.createDirectories(Paths.get(directory.getPath(), "foo")).toFile();
    File script = Files.createFile(Paths.get(directory.getPath(), "foo", "modelRun.R")).toFile();
    PrintWriter writer = new PrintWriter(script);
    for (String line : lines) {
        writer.println(line);
    }
    writer.close();
    return script;
}
 
开发者ID:SEEG-Oxford,项目名称:ABRAID-MP,代码行数:12,代码来源:CommonsExecIntegrationTest.java

示例6: mockBucket

import org.junit.rules.TemporaryFolder; //导入方法依赖的package包/类
/**
 * Constructs a mock bucket.
 * @param name Bucket name.
 * @throws IOException In case of failure.
 * @return The mock bucket.
 */
private MkBucket mockBucket(final String name) throws IOException {
    final TemporaryFolder folder = new TemporaryFolder();
    folder.create();
    return new MkBucket(folder.getRoot(), name);
}
 
开发者ID:libreio,项目名称:libre,代码行数:12,代码来源:AwsDocTest.java


注:本文中的org.junit.rules.TemporaryFolder.getRoot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。