### Question:
ScriptConfigurationDataStore implements ScriptingDataStore { @Override public void delete(String uuid) throws ScriptException { ScriptConfiguration scriptConfig = get(uuid); if (containsGlobalUuid(uuid) || isDefaultScript(scriptConfig)) { throw new ScriptException(DELETING_DEFAULT_SCRIPT, scriptConfig.getName()); } int usageCount = getUsageCount(scriptConfig); if (usageCount > 0) { ScriptContext scriptContext = scriptConfig.getContext(); if (usageCount == 1) { throw new ScriptException(DELETING_SCRIPT_IN_USE_SINGULAR, scriptConfig.getName()); } throw new ScriptException(DELETING_SCRIPT_IN_USE_PLURAL, scriptConfig.getName(), Integer.toString(usageCount)); } try { getSubOrgConfig().removeSubConfig(uuid); } catch (SSOException | SMSException e) { throw createAndLogError(logger, DELETE_FAILED, e, uuid, realm); } } @Inject  ScriptConfigurationDataStore(@Named("ScriptLogger") Logger logger,
                                        @Assisted Subject subject, @Assisted String realm); @Override void save(ScriptConfiguration config); @Override void delete(String uuid); @Override Set<ScriptConfiguration> getAll(); @Override ScriptConfiguration get(String uuid); @Override boolean containsUuid(String uuid); @Override boolean containsName(String name); @Override Set<ScriptConfiguration> get(QueryFilter<String> queryFilter);  }### Answer:
@Test public void shouldFailIfConfigDoesNotExistOnDelete() throws ScriptException { String uuid = "1234567890"; try { dataStore.delete(uuid); fail("shouldFailIfConfigDoesNotExistOnDelete"); } catch (ScriptException e) { assertEquals(e.getScriptErrorCode(), RETRIEVE_FAILED); } }
@Test public void shouldFailIfAttemptingToDeleteDefaultScript() throws Exception { String uuid = "1234567890"; ServiceConfig defaultScriptSubConfig = mock(ServiceConfig.class); given(subGlobalConfig.getSubConfig(uuid)).willReturn(defaultScriptSubConfig); given(defaultScriptSubConfig.exists()).willReturn(true); try { dataStore.delete(uuid); fail("shouldFailIfAttemptingToDeleteDefaultScript"); } catch (ScriptException e) { assertEquals(e.getScriptErrorCode(), RETRIEVE_FAILED); } }