### Question:
AlertScriptDispatcher implements NotificationDispatcher { String getScriptLocation(Notification notification){ String scriptName = null; String scriptDir = null; if( null == notification || null == notification.DispatchProperties ) return null; scriptName = notification.DispatchProperties.get(DISPATCH_PROPERTY_SCRIPT_FILENAME_KEY); if( null == scriptName) { LOG.warn("the {} configuration property was not found for dispatching notification", DISPATCH_PROPERTY_SCRIPT_FILENAME_KEY); return null; } scriptDir = m_configuration.getDispatchScriptDirectory(); return scriptDir + File.separator + scriptName; }  String getScriptConfigurationKey( Notification notification ); long getScriptConfigurationTimeout(); @Override final String getType(); @Override final boolean isNotificationContentGenerationRequired(); @Override void dispatch(Notification notification); @Override final boolean isDigestSupported(); @Override final TargetConfigurationResult validateTargetConfig(Map<String, Object> properties); static final String SCRIPT_CONFIG_DEFAULT_KEY; static final String SCRIPT_CONFIG_TIMEOUT_KEY; static final String DISPATCH_PROPERTY_SCRIPT_CONFIG_KEY; static final String DISPATCH_PROPERTY_SCRIPT_FILENAME_KEY; static final Escaper SHELL_ESCAPE; }### Answer:
@Test public void testGetScriptLocation() throws Exception { AlertScriptDispatcher dispatcher = (AlertScriptDispatcher) m_dispatchFactory.getDispatcher(TargetType.ALERT_SCRIPT.name()); m_injector.injectMembers(dispatcher); DispatchCallback callback = EasyMock.createNiceMock(DispatchCallback.class); AlertNotification notification = new AlertNotification(); notification.Callback = callback; notification.CallbackIds = Collections.singletonList(UUID.randomUUID().toString()); notification.DispatchProperties = new HashMap(); Assert.assertEquals(dispatcher.getScriptLocation(notification),null); final String filename = "foo.py"; notification.DispatchProperties.put(AlertScriptDispatcher.DISPATCH_PROPERTY_SCRIPT_FILENAME_KEY,filename); Assert.assertEquals(dispatcher.getScriptLocation(notification),"/var/lib/ambari-server/resources/scripts/foo.py"); final String scriptDirectory = "/var/lib/ambari-server/resources/scripts/foo"; m_configuration.setProperty(DISPATCH_PROPERTY_SCRIPT_DIRECTORY_KEY,scriptDirectory); Assert.assertEquals(dispatcher.getScriptLocation(notification),"/var/lib/ambari-server/resources/scripts/foo/foo.py"); }