Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
a57e6495
Commit
a57e6495
authored
Jul 19, 2017
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate from FileSystemUtils.deleteRecursively
Update test to migrate away from the now deprecated FileSystemUtils.
parent
75aebfaf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
SampleIntegrationApplicationTests.java
...tegration/consumer/SampleIntegrationApplicationTests.java
+9
-4
No files found.
spring-boot-samples/spring-boot-sample-integration/src/test/java/sample/integration/consumer/SampleIntegrationApplicationTests.java
View file @
a57e6495
...
...
@@ -19,6 +19,10 @@ package sample.integration.consumer;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.file.FileVisitOption
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.util.Comparator
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Future
;
...
...
@@ -35,7 +39,6 @@ import org.springframework.context.ConfigurableApplicationContext;
import
org.springframework.core.io.DefaultResourceLoader
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.support.ResourcePatternUtils
;
import
org.springframework.util.FileSystemUtils
;
import
org.springframework.util.StreamUtils
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
...
...
@@ -51,14 +54,16 @@ public class SampleIntegrationApplicationTests {
private
ConfigurableApplicationContext
context
;
@Before
public
void
deleteInputAndOutput
()
throws
InterruptedException
{
public
void
deleteInputAndOutput
()
throws
InterruptedException
,
IOException
{
deleteIfExists
(
new
File
(
"target/input"
));
deleteIfExists
(
new
File
(
"target/output"
));
}
private
void
deleteIfExists
(
File
directory
)
throws
InterruptedException
{
private
void
deleteIfExists
(
File
directory
)
throws
InterruptedException
,
IOException
{
if
(
directory
.
exists
())
{
assertThat
(
FileSystemUtils
.
deleteRecursively
(
directory
)).
isTrue
();
Files
.
walk
(
directory
.
toPath
(),
FileVisitOption
.
FOLLOW_LINKS
)
.
sorted
(
Comparator
.
reverseOrder
()).
map
(
Path:
:
toFile
)
.
forEach
(
File:
:
delete
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment