Base on the comment of Daniel Oechslin, we should have the function in your case like this:
public class IvyMock extends MockUp<Ivy> {
@Mock
public static IGlobalVariableContext var() {
return new IGlobalVariableContext() {
@Override
@PublicAPI(IvyScriptVisibility.EXPERT)
public String get(String varName) {
Configuration config = Configuration.getInstance();
String value = "";
if(varName.equalsIgnoreCase(yourVarName)){ //example: xabs_dateFormat_portal
value = yourValueVar; //example: yyyy/MM/dd
}
//else if(...
// other cases here
return value;
}
@Override
public Set<String> getVariableNames() {
return null;
}
};
}
}