diff --git a/core/modules/user/src/TempStore.php b/core/modules/user/src/TempStore.php
index da87691..9058895 100644
--- a/core/modules/user/src/TempStore.php
+++ b/core/modules/user/src/TempStore.php
@@ -181,7 +181,7 @@ public function set($key, $value) {
     if (!$this->lockBackend->acquire($key)) {
       $this->lockBackend->wait($key);
       if (!$this->lockBackend->acquire($key)) {
-        throw new TempStoreException(String::format("Couldn't acquire lock to update item %key in %collection temporary storage.", array(
+         throw new TempStoreException(String::format("Couldn't acquire lock to update item %key in %collection temporary storage.", array(
           '%key' => $key,
           '%collection' => $this->storage->getCollectionName(),
         )));
diff --git a/core/modules/user/tests/src/Unit/TempStoreTest.php b/core/modules/user/tests/src/Unit/TempStoreTest.php
index 68b4e70..9d607f4 100644
--- a/core/modules/user/tests/src/Unit/TempStoreTest.php
+++ b/core/modules/user/tests/src/Unit/TempStoreTest.php
@@ -2,20 +2,72 @@
 
 /**
  * @file
- * Contains \Drupal\Tests\user\Unit\TempStoreTest.
+ * Contains \Drupal\user\Tests\TempStoreTest\TempStoreTest.
  */
 
-namespace Drupal\Tests\user\Unit;
+namespace Drupal\user\Tests\TempStoreTest;
 
+use Drupal\Core\KeyValueStore\NullStorageExpirable;
 use Drupal\Tests\UnitTestCase;
 use Drupal\user\TempStore;
 
 /**
- * @coversDefaultClass \Drupal\user\TempStore
- * @group user
- */
++ * Tests the user tempstore.
++ *
++ * @see \Drupal\user\Tempstore
++ */
 class TempStoreTest extends UnitTestCase {
+  
+  public static function getInfo() {
+    return array(
+      'name' => 'TempStore',
+      'description' => 'Tests the temporary object storage system.',
+      'group' => 'TempStore',
+    );
+  }
+  /**
+   * Tests lock on the set method.
+   *
+   * @expectedException \Drupal\user\TempStoreException
+   */
+  public function testLockedSet() {
+    $storage = new NullStorageExpirable('tempstore');
+    $lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
 
+    // Explicit ensure that the acquire method fails all the time.
+    $lock->expects($this->at(0))
+      ->method('acquire')
+      ->will($this->returnValue(FALSE));
+
+    $lock->expects($this->at(1))
+      ->method('acquire')
+      ->will($this->returnValue(FALSE));
+
+    $tempstore = new TempStore($storage, $lock, 1);
+    $tempstore->set('key', 'value');
+  }
+
+  /**
+   * Tests lock on the delete method.
+   *
+   * @expectedException \Drupal\user\TempStoreException
+   */
+  public function testLockedDelete() {
+    $storage = new NullStorageExpirable('tempstore');
+    $lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface');
+
+    // Explicit ensure that the acquire method fails all the time.
+    $lock->expects($this->at(0))
+      ->method('acquire')
+      ->will($this->returnValue(FALSE));
+
+    $lock->expects($this->at(1))
+      ->method('acquire')
+      ->will($this->returnValue(FALSE));
+
+    $tempstore = new TempStore($storage, $lock, 1);
+    $tempstore->delete('key');
+  }
   /**
    * The mock key value expirable backend.
    *
