{"id":48330,"date":"2017-07-07T15:00:38","date_gmt":"2017-07-07T12:00:38","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=48330"},"modified":"2019-03-20T13:47:44","modified_gmt":"2019-03-20T11:47:44","slug":"junit-temporary-folder-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/","title":{"rendered":"JUnit Temporary Folder Example"},"content":{"rendered":"<p>In this tutorial, we shall show users the usage of JUnit Temporary Folder. JUnit Temporary Folder Example is a simple example showing how we can use and why we should use this feature of the JUnit.<\/p>\n<p>Basic tutorials about JUnit can be found <a href=\"https:\/\/examples.javacodegeeks.com\/category\/core-java\/junit\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;\n<\/p>\n<h2>1. Introduction<\/h2>\n<p>There are some scenarios where we want to create a temporary folder and then delete after test complete. This can be achieved manually by creating a folder through the code and then delete after the test is complete.<\/p>\n<p>But this can also be achieved with the help of the JUnit <code>TemporaryFolder<\/code> Rule. JUnit provides a very beautiful way of handling such scenarios. It provides us with the Rule, where we simply define it and then creation and deletion of the folder is handled by JUnit automatically.<\/p>\n<h2>2. Technologies Used<\/h2>\n<p>We will be using the following technologies while building an example. Here we are taking the latest version of each technology.<\/p>\n<ul>\n<li><strong>Java 1.8<\/strong> \u2013 We will be using the latest version of Java. There is no specific feature of Java 1.8 that has been used.<\/li>\n<li><strong>JUnit 4.12<\/strong> \u2013 This is the main testing framework that we will be using.<\/li>\n<li><strong>Maven<\/strong> \u2013 This is the build and dependency tool for this example.<\/li>\n<li><strong>Eclipse<\/strong> \u2013 IDE for writing the code.<\/li>\n<\/ul>\n<p>For links to the latest versions and there websites visit the <a href=\"#references\"><strong>reference<\/strong><\/a> section of the tutorial. Now, we have defined the technologies to be used. Let\u2019s start the setup of our example.<\/p>\n<h2>3. Project Setup<\/h2>\n<div class=\"tip\"><strong>Tip<\/strong><br \/>\nYou may skip project creation and jump directly to the <a href=\"#code\"><strong>beginning of the example<\/strong><\/a> below.<\/div>\n<p>As you already know, we are using the Eclipse. So start by opening the Eclipse. Click on the <strong>File -&gt; New -&gt; Maven Project<\/strong>. You will see the first screen as shown here. Simply check the first checkbox and click on the <strong>Next<\/strong> button.<\/p>\n<p><figure id=\"attachment_48422\" aria-describedby=\"caption-attachment-48422\" style=\"width: 725px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/07\/junit_temporary_setup_1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48422\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/07\/junit_temporary_setup_1.jpg\" alt=\"JUnit Temporary Folder Example Setup 1\" width=\"725\" height=\"503\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/07\/junit_temporary_setup_1.jpg 725w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/07\/junit_temporary_setup_1-300x208.jpg 300w\" sizes=\"(max-width: 725px) 100vw, 725px\" \/><\/a><figcaption id=\"caption-attachment-48422\" class=\"wp-caption-text\">Figure 1: JUnit Temporary Folder Example Setup 1<\/figcaption><\/figure><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>On this screen, you need to fill in the details regarding the project we are building. You can simply fill in the following details as shown and click on the <strong>Finish<\/strong> button.<\/p>\n<p><figure id=\"attachment_48423\" aria-describedby=\"caption-attachment-48423\" style=\"width: 720px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/07\/junit_temporary_setup_2.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48423\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/07\/junit_temporary_setup_2.jpg\" alt=\"JUnit Temporary Folder Example Setup 2\" width=\"720\" height=\"661\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/07\/junit_temporary_setup_2.jpg 720w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/07\/junit_temporary_setup_2-300x275.jpg 300w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/a><figcaption id=\"caption-attachment-48423\" class=\"wp-caption-text\">Figure 2: JUnit Temporary Folder Example Setup 2<\/figcaption><\/figure><\/p>\n<p>After clicking on the Finish button, we are ready with the blank Maven project. But before we start with the code, we need to do some changes in the <code>pom.xml<\/code> file.<br \/>\n<span id=\"code\"><\/span><br \/>\n<span style=\"text-decoration: underline;\"><em>pom.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml;wrap-lines:false;highlight:[4,18,19]\">...\n&lt;dependencies&gt;\n    &lt;dependency&gt;\n        &lt;groupId&gt;junit&lt;\/groupId&gt;\n        &lt;artifactId&gt;junit&lt;\/artifactId&gt;\n        &lt;version&gt;4.12&lt;\/version&gt;\n    &lt;\/dependency&gt;\n&lt;\/dependencies&gt;\n&lt;build&gt;\n    &lt;finalName&gt;junittemporaryfolder&lt;\/finalName&gt;\n    &lt;plugins&gt;\n        &lt;plugin&gt;\n            &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\n            &lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;\n            &lt;version&gt;2.5.1&lt;\/version&gt;\n            &lt;inherited&gt;true&lt;\/inherited&gt;\n            &lt;configuration&gt;\n                &lt;source&gt;1.8&lt;\/source&gt;\n                &lt;target&gt;1.8&lt;\/target&gt;\n            &lt;\/configuration&gt;\n        &lt;\/plugin&gt;\n    &lt;\/plugins&gt;\n&lt;\/build&gt;\n...\n<\/pre>\n<p><strong>Line 4<\/strong>: actually pulls out the JUnit for this project.<br \/>\n<strong>Line 18,19<\/strong>: tells maven to compile and build with Java 8.<\/p>\n<h2>4. JUnit Temporary Folder Example<\/h2>\n<p>In this example, we will create four test cases and show how to create and delete, files and folders using the <code>TemporaryFolder<\/code> Rule of JUnit.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>TemporaryFolderTest.java<\/em><\/span><\/p>\n<pre class=\"brush:java;wrap-lines:false;highlight:[15,16,19,25,32,38]\">package junittemporaryfolder;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\nimport java.io.File;\nimport java.io.IOException;\n\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.rules.TemporaryFolder;\n\npublic class TemporaryFolderTest {\n    \n    @Rule\n    public TemporaryFolder tempFolder = new TemporaryFolder();\n    \n    @Test\n    public void testCreateFile() throws IOException{\n        File file = tempFolder.newFile(\"test.txt\");\n        assertTrue(file.exists());\n    }\n    \n    @Test\n    public void testDeleteFile() throws IOException{\n        File file = tempFolder.newFile(\"test.txt\");\n        file.delete();\n        assertFalse(file.exists());\n    }\n    \n    @Test\n    public void testCreateFolder() throws IOException{\n        File file = tempFolder.newFolder(\"testfolder\");\n        assertTrue(file.exists());\n    }\n    \n    @Test\n    public void testDeleteFolder() throws IOException{\n        File file = tempFolder.newFile(\"testfolder\");\n        file.delete();\n        assertFalse(file.exists());\n    }\n\n}\n\n<\/pre>\n<p>Let&#8217;s analyze the code:<br \/>\n<strong>Line 15,16<\/strong>: These are the main lines of this example. We have used the <code>@Rule<\/code> annotation of JUnit to define the rule. On next line, we have defined the <code>TemporaryFolder<\/code> class, which is used for creation and deletion of temporary files and folders.<br \/>\n<strong>Line 19<\/strong>: In this test case we simply create a new file using the <code>newFile()<\/code> method of the <code>TemporaryFolder<\/code> class. This will create a temporary file with the name &#8220;<em>test.txt<\/em>&#8220;. On next line, we test with the <code>assertTrue()<\/code>, that the file is created. If file is created it will pass else it will fail.<br \/>\n<strong>Line 25<\/strong>: Similar to test case in <strong>line 19<\/strong>, we will first create a file and on next line we will delete it. Further we will test for the file existence.<br \/>\n<strong>Line 32<\/strong>: In above test case we have created a file and then test its existence. Similarly, in this test case we will create a temporary folder using the <code>newFolder()<\/code> method of <code>TemporaryFolder<\/code> class. First we will create a folder and then on next line we test for its existence using the <code>assertTrue()<\/code> method of the JUnit. Id folder is created, test case will pass else it will fail.<br \/>\n<strong>Line 38<\/strong>: Similar to the test case at <strong>line 32<\/strong>, in this test case first we will create a folder, then we will delete it and then we will test for its existence.[ulp id=&#8217;ODQaBEw1BIbHApZq&#8217;]<\/p>\n<h2>5. Conclusion<\/h2>\n<p>In JUnit Temporary Folder example, we have seen the use of the powerful feature of the JUnit framework. <code>TemporaryFolder<\/code> class provides a feature to create a temporary file or folder as the test runtime and delete as soon as the test case is finished.<\/p>\n<p>This can be a power to developers who want to create temporary file and folders during test run time. They do not have to manually create or delete the temporary folders.<\/p>\n<h2>6. Download the Eclipse Project<\/h2>\n<p>This is a JUnit Temporary Folder Example<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/07\/junittemporaryfolder.zip\"><strong>JUnitTemporaryFolder.zip<\/strong><\/a><\/div>\n<h2><a name=\"references\"><\/a>7. References<\/h2>\n<ol>\n<li><a href=\"http:\/\/junit.org\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><strong>JUnit 4.12<\/strong><\/a><\/li>\n<li><a href=\"http:\/\/maven.apache.org\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><strong>Maven<\/strong><\/a><\/li>\n<li><a href=\"http:\/\/junit.org\/junit4\/javadoc\/4.12\/org\/junit\/rules\/TemporaryFolder.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><strong>TemporaryFolder class API<\/strong><\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we shall show users the usage of JUnit Temporary Folder. JUnit Temporary Folder Example is a simple example showing how we can use and why we should use this feature of the JUnit. Basic tutorials about JUnit can be found here. &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1. Introduction There &hellip;<\/p>\n","protected":false},"author":112,"featured_media":6678,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[1032],"class_list":["post-48330","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-junit","tag-junit"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JUnit Temporary Folder Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this tutorial we shall show users the usage of JUnit Temporary Folder. JUnit Temporary Folder Example is an simple exaple showing how we can use it\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JUnit Temporary Folder Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this tutorial we shall show users the usage of JUnit Temporary Folder. JUnit Temporary Folder Example is an simple exaple showing how we can use it\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-07-07T12:00:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-20T11:47:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Vinod Kumar Kashyap\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vinodkashyap\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vinod Kumar Kashyap\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/\"},\"author\":{\"name\":\"Vinod Kumar Kashyap\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/1d6281e8235e49b5b8614621c2445d2c\"},\"headline\":\"JUnit Temporary Folder Example\",\"datePublished\":\"2017-07-07T12:00:38+00:00\",\"dateModified\":\"2019-03-20T11:47:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/\"},\"wordCount\":782,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"keywords\":[\"junit\"],\"articleSection\":[\"junit\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/\",\"name\":\"JUnit Temporary Folder Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"datePublished\":\"2017-07-07T12:00:38+00:00\",\"dateModified\":\"2019-03-20T11:47:44+00:00\",\"description\":\"In this tutorial we shall show users the usage of JUnit Temporary Folder. JUnit Temporary Folder Example is an simple exaple showing how we can use it\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"junit\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/junit\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"JUnit Temporary Folder Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/1d6281e8235e49b5b8614621c2445d2c\",\"name\":\"Vinod Kumar Kashyap\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a11634ec460c849e8631b740af1b75cb68c9c58d5c2339c21bcd95f55b9af4f5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a11634ec460c849e8631b740af1b75cb68c9c58d5c2339c21bcd95f55b9af4f5?s=96&d=mm&r=g\",\"caption\":\"Vinod Kumar Kashyap\"},\"description\":\"Vinod is Sun Certified and love to work in Java and related technologies. Having more than 13 years of experience, he had developed software's including technologies like Java, Hibernate, Struts, Spring, HTML 5, jQuery, CSS, Web Services, MongoDB, AngularJS, AWS. He is also a JUG Leader of Chandigarh Java User Group.\",\"sameAs\":[\"http:\/\/www.vinodkashyap.com\/\",\"https:\/\/www.instagram.com\/vinodkashyap\/\",\"https:\/\/in.linkedin.com\/in\/vinodkashyap\",\"https:\/\/in.pinterest.com\/vinodkashyap\/\",\"https:\/\/x.com\/vinodkashyap\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/vinod-kashyap\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JUnit Temporary Folder Example - Java Code Geeks","description":"In this tutorial we shall show users the usage of JUnit Temporary Folder. JUnit Temporary Folder Example is an simple exaple showing how we can use it","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/","og_locale":"en_US","og_type":"article","og_title":"JUnit Temporary Folder Example - Java Code Geeks","og_description":"In this tutorial we shall show users the usage of JUnit Temporary Folder. JUnit Temporary Folder Example is an simple exaple showing how we can use it","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2017-07-07T12:00:38+00:00","article_modified_time":"2019-03-20T11:47:44+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","type":"image\/jpeg"}],"author":"Vinod Kumar Kashyap","twitter_card":"summary_large_image","twitter_creator":"@vinodkashyap","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Vinod Kumar Kashyap","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/"},"author":{"name":"Vinod Kumar Kashyap","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/1d6281e8235e49b5b8614621c2445d2c"},"headline":"JUnit Temporary Folder Example","datePublished":"2017-07-07T12:00:38+00:00","dateModified":"2019-03-20T11:47:44+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/"},"wordCount":782,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","keywords":["junit"],"articleSection":["junit"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/","name":"JUnit Temporary Folder Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","datePublished":"2017-07-07T12:00:38+00:00","dateModified":"2019-03-20T11:47:44+00:00","description":"In this tutorial we shall show users the usage of JUnit Temporary Folder. JUnit Temporary Folder Example is an simple exaple showing how we can use it","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-temporary-folder-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/"},{"@type":"ListItem","position":4,"name":"junit","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/junit\/"},{"@type":"ListItem","position":5,"name":"JUnit Temporary Folder Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/1d6281e8235e49b5b8614621c2445d2c","name":"Vinod Kumar Kashyap","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a11634ec460c849e8631b740af1b75cb68c9c58d5c2339c21bcd95f55b9af4f5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a11634ec460c849e8631b740af1b75cb68c9c58d5c2339c21bcd95f55b9af4f5?s=96&d=mm&r=g","caption":"Vinod Kumar Kashyap"},"description":"Vinod is Sun Certified and love to work in Java and related technologies. Having more than 13 years of experience, he had developed software's including technologies like Java, Hibernate, Struts, Spring, HTML 5, jQuery, CSS, Web Services, MongoDB, AngularJS, AWS. He is also a JUG Leader of Chandigarh Java User Group.","sameAs":["http:\/\/www.vinodkashyap.com\/","https:\/\/www.instagram.com\/vinodkashyap\/","https:\/\/in.linkedin.com\/in\/vinodkashyap","https:\/\/in.pinterest.com\/vinodkashyap\/","https:\/\/x.com\/vinodkashyap"],"url":"https:\/\/examples.javacodegeeks.com\/author\/vinod-kashyap\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/48330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/112"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=48330"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/48330\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/6678"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=48330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=48330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=48330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}