use of org.springframework.boot.devtools.restart.classloader.ClassLoaderFiles.SourceFolder in project spring-boot by spring-projects.
the class ClassLoaderFilesTests method addAll.
@Test
public void addAll() throws Exception {
ClassLoaderFile file1 = new ClassLoaderFile(Kind.ADDED, new byte[10]);
this.files.addFile("a", "myfile1", file1);
ClassLoaderFiles toAdd = new ClassLoaderFiles();
ClassLoaderFile file2 = new ClassLoaderFile(Kind.MODIFIED, new byte[10]);
ClassLoaderFile file3 = new ClassLoaderFile(Kind.MODIFIED, new byte[10]);
toAdd.addFile("a", "myfile2", file2);
toAdd.addFile("b", "myfile3", file3);
this.files.addAll(toAdd);
Iterator<SourceFolder> sourceFolders = this.files.getSourceFolders().iterator();
SourceFolder sourceFolder1 = sourceFolders.next();
SourceFolder sourceFolder2 = sourceFolders.next();
assertThat(sourceFolders.hasNext()).isFalse();
assertThat(sourceFolder1.getName()).isEqualTo("a");
assertThat(sourceFolder2.getName()).isEqualTo("b");
assertThat(sourceFolder1.getFiles()).containsOnly(file1, file2);
}
Aggregations