final List<FileObject> queueActual = new ArrayList<FileObject>();
queueActual.add(folder);
while (queueActual.size() > 0)
{
final FileObject file = queueActual.remove(0);
final FileInfo info = queueExpected.remove(0);
// Check the type is correct
assertSame(info.type, file.getType());
if (info.type == FileType.FILE)
{
continue;
}
// Check children
final FileObject[] children = file.getChildren();
// Make sure all children were found
assertNotNull(children);
int length = children.length;
if (info.children.size() != children.length)
{
for (int i=0; i < children.length; ++i)
{
if (children[i].getName().getBaseName().startsWith("."))
{
--length;
continue;
}
System.out.println(children[i].getName());
}
}
assertEquals("count children of \"" + file.getName() + "\"", info.children.size(), length);
// Recursively check each child
for (int i = 0; i < children.length; i++)
{
final FileObject child = children[i];
String childName = child.getName().getBaseName();
if (childName.startsWith("."))
{
continue;
}
final FileInfo childInfo = info.children.get(childName);