command.Name = "open";
command.Argument = cmargs2;
Object result = xCommandProcessor.execute(command, 0, null);
XDynamicResultSet xDynamicResultSet = UnoRuntime.queryInterface(XDynamicResultSet.class, result);
XResultSet xResultSet = xDynamicResultSet.getStaticResultSet();
XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet);
// create the new folder 'folderName': first, check if it's already there
while(xResultSet.next()) {
String existingFolderName = xRow.getString(1);
System.out.println("Found existing folder: '" + existingFolderName + "'");
if (folderName.equals(existingFolderName)) {
fail("Cannot create a new folder: folder already exists: adapt test or choose a different document.");
}