### Question:
TransformerUtils { @Nullable public static <T> T getOptionalScriptVariable( @Nonnull Map<String, Object> scriptVariables, @Nonnull ScriptVariable scriptVariable, @Nonnull Class<T> type ) throws FatalTransformerException { return type.cast( scriptVariables.get( scriptVariable.getVariableName() ) ); } private  TransformerUtils(); @Nullable static Reference createReference( @Nullable String value, @Nonnull Object referenceType ); @Nonnull static T getScriptVariable( @Nonnull Map<String, Object> scriptVariables, @Nonnull ScriptVariable scriptVariable, @Nonnull Class<T> type ); @Nullable static T getOptionalScriptVariable( @Nonnull Map<String, Object> scriptVariables, @Nonnull ScriptVariable scriptVariable, @Nonnull Class<T> type ); @Nonnull static T getScriptVariable( @Nonnull ScriptExecutionContext scriptExecutionContext, @Nonnull String name, @Nonnull Class<T> c ); @Nonnull static T getScriptContextVariable( @Nonnull ScriptExecutionContext scriptExecutionContext, @Nonnull String name, @Nonnull Class<T> c ); @Nonnull static Map<String, Object> createScriptContextVariables( @Nonnull TransformerContext transformerContext, @Nonnull RuleInfo<? extends AbstractRule> ruleInfo ); @Nullable static T executeScript( @Nonnull ScriptExecutor scriptExecutor, @Nonnull TransformerContext context, @Nonnull RuleInfo<? extends AbstractRule> ruleInfo, @Nullable ExecutableScript executableScript,
        @Nonnull Map<String, Object> variables, @Nonnull Class<T> resultClass ); static final String TRANSFORMER_CONTEXT_VAR_NAME; static final String RULE_VAR_NAME; }### Answer:
@Test public void getOptionalScriptVariable() { final Map<String, Object> variables = new HashMap<>(); variables.put( ScriptVariable.ORGANIZATION_UNIT_ID.getVariableName(), "test1" ); Assert.assertEquals( "test1", TransformerUtils.getOptionalScriptVariable( variables, ScriptVariable.ORGANIZATION_UNIT_ID, String.class ) ); }
@Test public void getOptionalScriptVariableNotFound() { final Map<String, Object> variables = new HashMap<>(); Assert.assertNull( TransformerUtils.getOptionalScriptVariable( variables, ScriptVariable.ORGANIZATION_UNIT_ID, String.class ) ); }