}
xNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oObj);
XNameContainer xNC = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oObj);
XNameReplace xNR = (XNameReplace) UnoRuntime.queryInterface(XNameReplace.class, oObj);
XFlushable xFlush = (XFlushable) UnoRuntime.queryInterface(XFlushable.class, oObj);
instance = (Object[]) xNA.getByName(filterName);
PropertyValue[] props = (PropertyValue[]) instance;
printPropertyValues(props);
boolean isMandatory = ((Boolean) getPropertyValueValue(props, "Mandatory")).booleanValue();
boolean isFinalized = ((Boolean) getPropertyValueValue(props, "Finalized")).booleanValue();
// memory if every state is available
mandantoryTrue |= isMandatory;
mandantoryFalse |= !isMandatory;
finalizedTrue |= isFinalized;
finalizedFalse |= !isFinalized;
//change the filter
setPropertyValueValue((PropertyValue[])instance, "UIName", "dummy");
// 1a.) try to change the filter in the container
try{
xNR.replaceByName(filterName, instance);
}catch (IllegalArgumentException e){
failed("could not replace filter properties ('" + filterName + "')", CONTINUE);
}
// 1b.) try to wirte the changed filter to the configuration.
// This must result in a exception if the filter is finalized.
boolean flushError = false;
try{
xFlush.flush();
} catch (WrappedTargetRuntimeException e){
flushError = true;
assure("Unexpected exception wihle flushing changed filter '"+ filterName + "'", isFinalized,CONTINUE);
}
assure("Expected exception was not thorwn while flushing changed filter '"+ filterName + "' Finalized:" + isFinalized,
!(flushError ^ isFinalized), CONTINUE);
// 2a.) try to remove the filter from the container
try{
xNC.removeByName(filterName);
}catch (NoSuchElementException e){
failed("could not remove filter from container ('" + filterName + "')", CONTINUE);
}
// 1b.) try to wirte the changed filter to the configuration.
// This must result in a exception if the filter is mandatory
flushError = false;
try{
xFlush.flush();
} catch (WrappedTargetRuntimeException e){
flushError = true;
assure("Unexpected exception wihle flushing removed filter '"+ filterName + "'", isMandatory,CONTINUE);
}
assure("Expected exception was not thorwn while flushing removed filter '"+ filterName + "' Mandatory:" + isMandatory,