public void testDetermineScriptWithNonSharedInstance() { AgiScript scriptFirstPass; AgiScript scriptSecondPass; AgiRequest request; mappingStrategy.setShareInstances(false); request = new SimpleAgiRequest(); scriptFirstPass = mappingStrategy.determineScript(request); scriptSecondPass = mappingStrategy.determineScript(request); assertEquals("incorrect script determined", scriptFirstPass.getClass(), HelloAgiScript.class); assertTrue("returned a shared instance", scriptFirstPass != scriptSecondPass); }
public void testDetermineScript() { AgiScript scriptFirstPass; AgiScript scriptSecondPass; AgiRequest request; request = new SimpleAgiRequest(); scriptFirstPass = mappingStrategy.determineScript(request); scriptSecondPass = mappingStrategy.determineScript(request); assertNotNull("no script determined", scriptFirstPass); assertEquals("incorrect script determined", scriptFirstPass.getClass(), HelloAgiScript.class); assertTrue("script instances are not cached", scriptFirstPass == scriptSecondPass); }
public void testDetermineScriptWithResourceBundleUnavailable() { AgiRequest request; request = new SimpleAgiRequest(); mappingStrategy.setResourceBundleName("net.sf.asterisk.fastagi.unavailable"); assertNull(mappingStrategy.determineScript(request)); }