### Question:
ScriptConfigurationService implements ScriptingService { @Override public ScriptConfiguration update(ScriptConfiguration config) throws ScriptException { final ScriptConfiguration oldConfig = get(config.getId()); if (!oldConfig.getName().equals(config.getName())) { failIfNameExists(config.getName()); } final ScriptConfiguration updatedConfig = setMetaData(config); dataStore.save(updatedConfig); return updatedConfig; } @Inject  ScriptConfigurationService(@Named("ScriptLogger") Logger logger,
                                      @Assisted Subject subject, @Assisted String realm,
                                      ScriptingDataStoreFactory dataStoreFactory); @Override ScriptConfiguration create(ScriptConfiguration config); @Override void delete(String uuid); @Override Set<ScriptConfiguration> getAll(); @Override Set<ScriptConfiguration> get(QueryFilter<String> queryFilter); @Override ScriptConfiguration get(String uuid); @Override ScriptConfiguration update(ScriptConfiguration config);  }### Answer:
@Test public void shouldFailIfUuidDoesNotExistOnUpdate() throws ScriptException { ScriptConfiguration scNew = ScriptConfiguration.builder() .generateId() .setName("MyJavaScript") .setDescription("This is a test script configuration") .setScript("var a = 123;var b = 456;") .setLanguage(JAVASCRIPT) .setContext(POLICY_CONDITION).build(); when(dataStore.containsUuid(anyString())).thenReturn(false); try { service.update(scNew); fail("shouldFailIfUuidDoesNotExistOnUpdate"); } catch (ScriptException e) { assertEquals(e.getScriptErrorCode(), SCRIPT_UUID_NOT_FOUND); } }