Merge branch 'master' of https://github.com/Maiklins/tutorials into JAVA-3528-move-spring-mvc-velocity-module
Conflicts: spring-web-modules/pom.xml
This commit is contained in:
commit
c2a10624ec
|
@ -24,9 +24,20 @@ public class ListFiles {
|
|||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
public Set<String> listFilesUsingFilesList(String dir) throws IOException {
|
||||
try (Stream<Path> stream = Files.list(Paths.get(dir))) {
|
||||
return stream
|
||||
.filter(file -> !Files.isDirectory(file))
|
||||
.map(Path::getFileName)
|
||||
.map(Path::toString)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
||||
public Set<String> listFilesUsingFileWalk(String dir, int depth) throws IOException {
|
||||
try (Stream<Path> stream = Files.walk(Paths.get(dir), depth)) {
|
||||
return stream.filter(file -> !Files.isDirectory(file))
|
||||
return stream
|
||||
.filter(file -> !Files.isDirectory(file))
|
||||
.map(Path::getFileName)
|
||||
.map(Path::toString)
|
||||
.collect(Collectors.toSet());
|
||||
|
|
|
@ -25,10 +25,15 @@ public class ListFilesUnitTest {
|
|||
};
|
||||
|
||||
@Test
|
||||
public void givenDir_whenUsingJAVAIO_thenListAllFiles() throws IOException {
|
||||
public void givenDir_whenUsingJAVAIO_thenListAllFiles() {
|
||||
assertEquals(EXPECTED_FILE_LIST, listFiles.listFilesUsingJavaIO(DIRECTORY));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenDir_whenUsingFilesList_thenListAllFiles() throws IOException {
|
||||
assertEquals(EXPECTED_FILE_LIST, listFiles.listFilesUsingFilesList(DIRECTORY));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenDir_whenWalkingTree_thenListAllFiles() throws IOException {
|
||||
assertEquals(EXPECTED_FILE_LIST, listFiles.listFilesUsingFileWalk(DIRECTORY,DEPTH));
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -664,7 +664,6 @@
|
|||
<module>spring-mvc-java-2</module>
|
||||
|
||||
<module>spring-mvc-views</module>
|
||||
<module>spring-mvc-webflow</module>
|
||||
<module>spring-mvc-xml</module>
|
||||
|
||||
<module>spring-protobuf</module>
|
||||
|
@ -1131,7 +1130,6 @@
|
|||
<module>spring-mvc-java-2</module>
|
||||
|
||||
<module>spring-mvc-views</module>
|
||||
<module>spring-mvc-webflow</module>
|
||||
<module>spring-mvc-xml</module>
|
||||
|
||||
<module>spring-protobuf</module>
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<module>spring-mvc-crash</module>
|
||||
<module>spring-mvc-forms-jsp</module>
|
||||
<module>spring-mvc-velocity</module>
|
||||
<module>spring-mvc-webflow</module>
|
||||
<module>spring-rest-angular</module>
|
||||
<module>spring-rest-http</module>
|
||||
<module>spring-resttemplate-2</module>
|
||||
|
|
Loading…
Reference in New Issue