### Question:
ExtensionManagerScriptService extends AbstractExtensionScriptService { public Job install(String id, String version, String namespace) { return install(createInstallRequest(id, version, namespace)); }  @SuppressWarnings("unchecked") S get(String serviceName); Collection<ExtensionRepository> getRepositories(); ExtensionRepository getRepository(String repositoryId); IterableResult<Extension> search(String pattern, int offset, int nb); IterableResult<Extension> search(ExtensionQuery query); ExtensionQuery newQuery(String query); Extension resolve(String id, String version); @Deprecated Extension resolve(ExtensionDependency extensionDependency); Extension resolve(ExtensionDependency extensionDependency, String namespace); IterableResult<Version> resolveVersions(String id, int offset, int nb); ExtensionId createExtensionId(String id, String version); InstallRequest createInstallRequest(String id, String version, String namespace); Job install(String id, String version, String namespace); Job install(InstallRequest installRequest); InstallRequest createInstallPlanRequest(String id, String version, String namespace); Job createInstallPlan(InstallRequest installRequest); Job createInstallPlan(String id, String version, String namespace); Job uninstall(String id, String namespace); Job uninstall(ExtensionId extensionId); Job uninstall(UninstallRequest uninstallRequest); UninstallRequest createUninstallRequest(String id, String namespace); @Unstable UninstallRequest createUninstallRequest(); Job createUninstallPlan(String id, String namespace); Job createUninstallPlan(ExtensionId extensionId); @Unstable Job createUninstallPlan(UninstallRequest uninstallRequest); InstallRequest createUpgradePlanRequest(String namespace); InstallRequest createUpgradePlanRequest(ExtensionId extensionId, String namespace); Job createUpgradePlan(InstallRequest request); Job createUpgradePlan(String namespace); Job createUpgradePlan(); Job getCurrentJob(); JobStatus getExtensionJobStatus(String extensionId, String namespace); JobStatus getExtensionPlanJobStatus(String extensionId, String namespace); JobStatus getCurrentJobStatus(); Version parseVersion(String version); VersionRange parseVersionRange(String versionRange); VersionConstraint parseVersionConstraint(String versionConstraint); ExtensionDependency createExtensionDependency(String id, String versionConstraint); ExtensionDependency createExtensionDependency(String id, String versionConstraint, boolean optional); boolean isAllowed(Collection<String> allowedNamespaces, String namespace); boolean isAllowed(Extension extension, String namespace); @Deprecated Collection<InstalledExtension> getInstalledExtensions(); @Deprecated Collection<InstalledExtension> getInstalledExtensions(String namespace); @Deprecated InstalledExtension getInstalledExtension(String feature, String namespace); @Deprecated Map<String, Collection<InstalledExtension>> getBackwardDependencies(String feature, String version); @Deprecated Collection<CoreExtension> getCoreExtensions(); @Deprecated CoreExtension getCoreExtension(String feature); @Deprecated Collection<LocalExtension> getLocalExtensions(); Extension getAccessibleExtension(String feature, Namespace namespace); IterableResult<Extension> searchAccessibleExtensions(Namespace namespace, ExtensionQuery query); static final String ROLEHINT; @Deprecated
    static final String EXTENSION_JOBID_PREFIX; @Deprecated
    static final String EXTENSIONACTION_JOBID_PREFIX; @Deprecated
    static final String EXTENSIONPLAN_JOBID_PREFIX; }### Answer:
@Test public void testInstallOnRoot() throws Throwable { install("extension", "version", null); }
@Test public void testInstallOnNamespace() throws Throwable { install("extension", "version", "namespace"); }
@Test(expected = InstallException.class) public void testInstallOnRootWithoutProgrammingRigths() throws Throwable { doThrow(AccessDeniedException.class).when(this.xwikiBridge.getMockAuthorizationManager()) .checkAccess(Right.PROGRAM, new DocumentReference("xwiki", "XWiki", "ExtensionUser"), null); install("extension", "version", null); }
@Test(expected = InstallException.class) public void testInstallOnNamespaceWithoutProgrammingRigths() throws Throwable { doThrow(AccessDeniedException.class).when(this.xwikiBridge.getMockAuthorizationManager()) .checkAccess(Right.PROGRAM, new DocumentReference("xwiki", "XWiki", "ExtensionUser"), null); install("extension", "version", "namespace"); }