@SuppressWarnings("unchecked") private ScriptResource fakeResource(ScriptResource sr) { given(sr.sha1()).willReturn("da39a3ee5e6b4b0d3255bfef95601890afd8070" + (++count)); given((ResourceIdentifier<ScriptResource, Void>) sr.identifier()) .willReturn( new MockResourceIdentifierMaker() .make(ScriptResource.class, AppBase, "script" + count)); return sr; }
@SuppressWarnings("unchecked") private void makeTargetFindable() { given( resourceFinder.loadResource( (ResourceIdentifier<ScriptResource, Void>) target.identifier())) .willReturn(target); }
@Before public void before() { given(target.base()).willReturn(AppBase); given(target.name()).willReturn(targetName); fakeResource(target); count = 0; dependencies = new MockAbstractScriptEnvironmentDependencies( JasmineScriptEnvironment.class, specName, makeResourceLoaded(target)); given(dependencies.mockRhinoContextProvider().context.newObject(global)).willReturn(global); given(dependencies.mockRhinoContextProvider().context.newChainedScope(global)) .willReturn(global); given(jasmine.script()).willReturn(jasmineScript); given(jasmineBoot.script()).willReturn(jasmineBootScript); fakeResource(jasmine); given(resourceFinder.loadResource(ScriptResource.class, Assets, "jasmine.js")) .willReturn(jasmine); fakeResource(jasmineBoot); given(resourceFinder.loadResource(ScriptResource.class, Assets, "jasmine-boot.js")) .willReturn(jasmineBoot); fakeResource(jasmineRun); given(resourceFinder.loadResource(ScriptResource.class, Assets, "jasmine-run.js")) .willReturn(jasmineRun); given(resourceFinder.loadResource(ScriptResource.class, AppBase, targetName)) .willReturn(target); given(spec.base()).willReturn(AppBase); given(spec.name()).willReturn(specName); }