Skip to main content
Skip table of contents

mockGlobalVariable

Versionshinweise

25.1

Code

CODE
void mockGlobalVariable(String variableName, Object value)

Beschreibung

Überschreibt temporär den Wert der Globalen Variable.

Parameter

  • variableName - Der Name der zu überschreibenden globalen Variable.

  • value - Den Wert, welchen die globale Variable annehmen soll.

Beispiele

CODE
// mocks the global variable 'MyGlobalVariable'  
Object mockValue = "MockValue";  
VariableUtils.mockGlobalVariable("MyGlobalVariable", mockValue);  
  
Object variableValue = VariableUtils.getGlobalVariable("MyGlobalVariable");  
Assertions.assertEquals("Global variable has been mocked", mockValue, variableValue); 
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.