當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。