diff --git a/core/lib/Drupal/Component/Plugin/Context/Context.php b/core/lib/Drupal/Component/Plugin/Context/Context.php
index c891e62..1c5b2d2 100644
--- a/core/lib/Drupal/Component/Plugin/Context/Context.php
+++ b/core/lib/Drupal/Component/Plugin/Context/Context.php
@@ -31,20 +31,16 @@ class Context implements ContextInterface {
   protected $contextDefinition;
 
   /**
-   * Sets the contextDefinition for us without needing to call the setter.
+   * Create a context object.
    *
    * @param \Drupal\Component\Plugin\Context\ContextDefinitionInterface $context_definition
    *   The context definition.
+   * @param mixed $context_value|NULL
+   *   The value of the context.
    */
-  public function __construct(ContextDefinitionInterface $context_definition) {
+  public function __construct(ContextDefinitionInterface $context_definition, $context_value = NULL) {
     $this->contextDefinition = $context_definition;
-  }
-
-  /**
-   * Implements \Drupal\Component\Plugin\Context\ContextInterface::setContextValue().
-   */
-  public function setContextValue($value) {
-    $this->contextValue = $value;
+    $this->contextValue = $context_value;
   }
 
   /**
@@ -75,27 +71,27 @@ public function hasContextValue() {
   }
 
   /**
-   * {@inheritdoc}
+   * Implements \Drupal\Component\Plugin\Context\ContextInterface::getContextDefinition().
    */
-  public function setContextDefinition(ContextDefinitionInterface $context_definition) {
-    $this->contextDefinition = $context_definition;
+  public function getContextDefinition() {
+    return $this->contextDefinition;
   }
 
   /**
-   * Implements \Drupal\Component\Plugin\Context\ContextInterface::getContextDefinition().
+   * {@inheritdoc}
    */
-  public function getContextDefinition() {
-    return $this->contextDefinition;
+  public function cloneWithValue($context_value) {
+    return new Context($this->contextDefinition, $context_value);
   }
 
   /**
    * Implements \Drupal\Component\Plugin\Context\ContextInterface::getConstraints().
    */
   public function getConstraints() {
-    if (empty($this->contextDefinition['class'])) {
+    if ($this->contextDefinition->getDataType() != 'class') {
       throw new ContextException("An error was encountered while trying to validate the context.");
     }
-    return array(new Type($this->contextDefinition['class']));
+    return array(new Type($this->contextDefinition->getDefaultValue()));
   }
 
   /**
diff --git a/core/lib/Drupal/Component/Plugin/Context/ContextInterface.php b/core/lib/Drupal/Component/Plugin/Context/ContextInterface.php
index 04948f9..11f9167 100644
--- a/core/lib/Drupal/Component/Plugin/Context/ContextInterface.php
+++ b/core/lib/Drupal/Component/Plugin/Context/ContextInterface.php
@@ -13,16 +13,6 @@
 interface ContextInterface {
 
   /**
-   * Sets the context value.
-   *
-   * @param mixed $value
-   *   The value of this context, matching the context definition.
-   *
-   * @see \Drupal\Component\Plugin\Context\ContextInterface::setContextDefinition().
-   */
-  public function setContextValue($value);
-
-  /**
    * Gets the context value.
    *
    * @return mixed
@@ -39,15 +29,6 @@ public function getContextValue();
   public function hasContextValue();
 
   /**
-   * Sets the definition that the context must conform to.
-   *
-   * @param \Drupal\Component\Plugin\Context\ContextDefinitionInterface $context_definition
-   *   A defining characteristic representation of the context against which
-   *   that context can be validated.
-   */
-  public function setContextDefinition(ContextDefinitionInterface $context_definition);
-
-  /**
    * Gets the provided definition that the context must conform to.
    *
    * @return \Drupal\Component\Plugin\Context\ContextDefinitionInterface
@@ -56,6 +37,16 @@ public function setContextDefinition(ContextDefinitionInterface $context_definit
   public function getContextDefinition();
 
   /**
+   * Creates a new context with a different value.
+   *
+   * @param mixed $value|NULL
+   *   The value of the new context object.
+   *
+   * @return \Drupal\Component\Plugin\Context\ContextInterface
+   */
+  public function cloneWithValue($context_value);
+
+  /**
    * Gets a list of validation constraints.
    *
    * @return array
diff --git a/core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php b/core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php
index d9c9c8a..8d604de 100644
--- a/core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php
+++ b/core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php
@@ -49,8 +49,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
     parent::__construct($configuration, $plugin_id, $plugin_definition);
     foreach ($context as $key => $value) {
       $context_definition = $this->getContextDefinition($key);
-      $this->context[$key] = new Context($context_definition);
-      $this->context[$key]->setContextValue($value);
+      $this->context[$key] = new Context($context_definition, $value);
     }
   }
 
@@ -124,7 +123,8 @@ public function getContextValue($name) {
    * {@inheritdoc}
    */
   public function setContextValue($name, $value) {
-    $this->getContext($name)->setContextValue($value);
+    $context = $this->getContext($name);
+    $this->context[$name] = $context->cloneWithValue($value);
     return $this;
   }
 
diff --git a/core/lib/Drupal/Core/Language/ContextProvider/CurrentLanguageContext.php b/core/lib/Drupal/Core/Language/ContextProvider/CurrentLanguageContext.php
index 94f39fd..ab1c980 100644
--- a/core/lib/Drupal/Core/Language/ContextProvider/CurrentLanguageContext.php
+++ b/core/lib/Drupal/Core/Language/ContextProvider/CurrentLanguageContext.php
@@ -13,6 +13,8 @@
 use Drupal\Core\Plugin\Context\ContextDefinition;
 use Drupal\Core\Plugin\Context\ContextProviderInterface;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
+use Drupal\Core\TypedData\DataDefinition;
+use Drupal\Core\TypedData\Plugin\DataType\Language;
 
 /**
  * Sets the current language as a context.
@@ -57,8 +59,9 @@ public function getRuntimeContexts(array $unqualified_context_ids) {
     $result = [];
     foreach ($language_types as $type_key) {
       if (isset($info[$type_key]['name'])) {
-        $context = new Context(new ContextDefinition('language', $info[$type_key]['name']));
-        $context->setContextValue($this->languageManager->getCurrentLanguage($type_key));
+        $context_value = Language::createInstance(DataDefinition::createFromDataType('language'));
+        $context_value->setValue($this->languageManager->getCurrentLanguage($type_key));
+        $context = new Context(new ContextDefinition('language', $info[$type_key]['name']), $context_value);
 
         $cacheability = new CacheableMetadata();
         $cacheability->setCacheContexts(['languages:' . $type_key]);
diff --git a/core/lib/Drupal/Core/Plugin/Context/Context.php b/core/lib/Drupal/Core/Plugin/Context/Context.php
index 837d601..3066c5f 100644
--- a/core/lib/Drupal/Core/Plugin/Context/Context.php
+++ b/core/lib/Drupal/Core/Plugin/Context/Context.php
@@ -43,11 +43,19 @@ class Context extends ComponentContext implements ContextInterface {
   protected $cacheabilityMetadata;
 
   /**
-   * {@inheritdoc}
+   * Create a context object.
+   *
+   * @param \Drupal\Core\Plugin\Context\ContextDefinitionInterface $context_definition
+   *   The context definition.
+   * @param \Drupal\Core\TypedData\TypedDataInterface $context_value
+   *   The Typed Data context value object.
    */
-  public function __construct(ContextDefinitionInterface $context_definition) {
-    parent::__construct($context_definition);
+  public function __construct(ContextDefinitionInterface $context_definition, TypedDataInterface $context_value = NULL) {
+    parent::__construct($context_definition, is_object($context_value) ? $context_value->getValue() : $context_value);
     $this->cacheabilityMetadata = new CacheableMetadata();
+    if (!is_null($context_value)) {
+      $this->setContextValue($context_value);
+    }
   }
 
   /**
@@ -80,20 +88,34 @@ public function hasContextValue() {
   }
 
   /**
-   * {@inheritdoc}
+   * Sets the context value.
+   *
+   * @param \Drupal\Core\TypedData\TypedDataInterface $value
+   *   The value of this context, matching the context definition.
+   *
+   * @return $this
    */
-  public function setContextValue($value) {
+  protected function setContextValue(TypedDataInterface $value) {
     // Add the value as a cacheable dependency only if implements the interface
     // to prevent it from disabling caching with a max-age 0.
     if ($value instanceof CacheableDependencyInterface) {
       $this->addCacheableDependency($value);
     }
-    if ($value instanceof TypedDataInterface) {
-      return $this->setContextData($value);
-    }
-    else {
-      return $this->setContextData($this->getTypedDataManager()->create($this->contextDefinition->getDataDefinition(), $value));
-    }
+
+    return $this->setContextData($value);
+  }
+
+  /**
+   * Sets the context value as typed data object.
+   *
+   * @param \Drupal\Core\TypedData\TypedDataInterface $data
+   *   The context value as a typed data object.
+   *
+   * @return $this
+   */
+  protected function setContextData(TypedDataInterface $data) {
+    $this->contextData = $data;
+    return $this;
   }
 
   /**
@@ -119,19 +141,22 @@ public function getContextData() {
     return $this->contextData;
   }
 
+
   /**
    * {@inheritdoc}
    */
-  public function setContextData(TypedDataInterface $data) {
-    $this->contextData = $data;
-    return $this;
+  public function getContextDefinition() {
+    return $this->contextDefinition;
   }
 
   /**
    * {@inheritdoc}
    */
-  public function getContextDefinition() {
-    return $this->contextDefinition;
+  public function cloneWithValue($context_value) {
+    if (!$context_value instanceof TypedDataInterface) {
+      $context_value = $this->getTypedDataManager()->create($this->contextDefinition->getDataDefinition(), $context_value);
+    }
+    return new Context($this->contextDefinition, $context_value);
   }
 
   /**
diff --git a/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php b/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php
index 373c73c..8c31371 100644
--- a/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php
+++ b/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php
@@ -72,6 +72,7 @@ public function getMatchingContexts(array $contexts, ContextDefinitionInterface
    * {@inheritdoc}
    */
   public function applyContextMapping(ContextAwarePluginInterface $plugin, $contexts, $mappings = array()) {
+    /** @var $contexts \Drupal\Core\Plugin\Context\ContextInterface[] */
     $mappings += $plugin->getContextMapping();
     // Loop through each of the expected contexts.
 
@@ -94,7 +95,7 @@ public function applyContextMapping(ContextAwarePluginInterface $plugin, $contex
 
         // Pass the value to the plugin if there is one.
         if ($contexts[$context_id]->hasContextValue()) {
-          $plugin->setContextValue($plugin_context_id, $contexts[$context_id]->getContextValue());
+          $plugin->setContextValue($plugin_context_id, $contexts[$context_id]->getContextData());
         }
         elseif ($plugin_context_definition->isRequired()) {
           // Collect required contexts that exist but are missing a value.
diff --git a/core/lib/Drupal/Core/Plugin/Context/ContextHandlerInterface.php b/core/lib/Drupal/Core/Plugin/Context/ContextHandlerInterface.php
index 2f1b785..14dd889 100644
--- a/core/lib/Drupal/Core/Plugin/Context/ContextHandlerInterface.php
+++ b/core/lib/Drupal/Core/Plugin/Context/ContextHandlerInterface.php
@@ -68,7 +68,7 @@ public function getMatchingContexts(array $contexts, ContextDefinitionInterface
    *
    * @param \Drupal\Core\Plugin\ContextAwarePluginInterface $plugin
    *   A plugin about to be evaluated.
-   * @param \Drupal\Component\Plugin\Context\ContextInterface[] $contexts
+   * @param \Drupal\Core\Plugin\Context\ContextInterface[] $contexts
    *   An array of contexts to set on the plugin. They will only be set if they
    *   match the plugin's context definitions.
    * @param array $mappings
diff --git a/core/lib/Drupal/Core/Plugin/Context/ContextInterface.php b/core/lib/Drupal/Core/Plugin/Context/ContextInterface.php
index 5b1e6bd..c507c89 100644
--- a/core/lib/Drupal/Core/Plugin/Context/ContextInterface.php
+++ b/core/lib/Drupal/Core/Plugin/Context/ContextInterface.php
@@ -17,21 +17,19 @@
 interface ContextInterface extends ComponentContextInterface, CacheableDependencyInterface {
 
   /**
-   * Gets the context value as typed data object.
+   * Gets the provided definition that the context must conform to.
    *
-   * @return \Drupal\Core\TypedData\TypedDataInterface
+   * @return \Drupal\Core\Plugin\Context\ContextDefinitionInterface
+   *   The defining characteristic representation of the context.
    */
-  public function getContextData();
+  public function getContextDefinition();
 
   /**
-   * Sets the context value as typed data object.
-   *
-   * @param \Drupal\Core\TypedData\TypedDataInterface $data
-   *   The context value as a typed data object.
+   * Gets the context value as typed data object.
    *
-   * @return $this
+   * @return \Drupal\Core\TypedData\TypedDataInterface
    */
-  public function setContextData(TypedDataInterface $data);
+  public function getContextData();
 
   /**
    * Adds a dependency on an object: merges its cacheability metadata.
diff --git a/core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php b/core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php
index 51a39d7..4c1d611 100644
--- a/core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php
+++ b/core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php
@@ -15,6 +15,7 @@
 use Drupal\Core\DependencyInjection\DependencySerializationTrait;
 use Drupal\Core\Plugin\Context\Context;
 use Drupal\Core\StringTranslation\StringTranslationTrait;
+use Drupal\Core\TypedData\TypedDataInterface;
 use Drupal\Core\TypedData\TypedDataTrait;
 use Drupal\Component\Plugin\Context\ContextInterface as ComponentContextInterface;
 use Drupal\Core\Plugin\Context\ContextInterface;
@@ -30,6 +31,9 @@
   /**
    * {@inheritdoc}
    *
+   * @return \Drupal\Core\Plugin\Context\ContextInterface
+   *   The context object.
+   *
    * This code is identical to the Component in order to pick up a different
    * Context class.
    */
@@ -55,6 +59,14 @@ public function setContext($name, ComponentContextInterface $context) {
   /**
    * {@inheritdoc}
    */
+  public function setContextValue($name, $value) {
+    $this->context[$name] = $this->getContext($name)->cloneWithValue($value);
+    return $this;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function getContextMapping() {
     $configuration = $this instanceof ConfigurablePluginInterface ? $this->getConfiguration() : $this->configuration;
     return isset($configuration['context_mapping']) ? $configuration['context_mapping'] : [];
@@ -85,6 +97,16 @@ public function getContextDefinitions() {
   }
 
   /**
+   * {@inheritdoc}
+   *
+   * @return \Drupal\Core\Plugin\Context\ContextDefinitionInterface
+   */
+  public function getContextDefinition($name) {
+    return parent::getContextDefinition($name);
+  }
+
+
+  /**
    * Wraps the context handler.
    *
    * @return \Drupal\Core\Plugin\Context\ContextHandlerInterface
diff --git a/core/modules/node/src/ContextProvider/NodeRouteContext.php b/core/modules/node/src/ContextProvider/NodeRouteContext.php
index e6f5781..5cb0a11 100644
--- a/core/modules/node/src/ContextProvider/NodeRouteContext.php
+++ b/core/modules/node/src/ContextProvider/NodeRouteContext.php
@@ -44,12 +44,14 @@ public function getRuntimeContexts(array $unqualified_context_ids) {
     $context = new Context(new ContextDefinition('entity:node', NULL, FALSE));
     if (($route_object = $this->routeMatch->getRouteObject()) && ($route_contexts = $route_object->getOption('parameters')) && isset($route_contexts['node'])) {
       if ($node = $this->routeMatch->getParameter('node')) {
-        $context->setContextValue($node);
+        $context = $context->cloneWithValue($node);
+        //$context = new Context(new ContextDefinition($route_contexts['node']['type']), EntityAdapter::createFromEntity($node->id()));
       }
     }
     elseif ($this->routeMatch->getRouteName() == 'node.add') {
       $node_type = $this->routeMatch->getParameter('node_type');
-      $context->setContextValue(Node::create(array('type' => $node_type->id())));
+      //$context = new Context(new ContextDefinition('entity:node'), EntityAdapter::createFromEntity(Node::create(array('type' => $node_type->id()))));
+      $context = $context->cloneWithValue(Node::create(array('type' => $node_type->id())));
     }
     $cacheability = new CacheableMetadata();
     $cacheability->setCacheContexts(['route']);
diff --git a/core/modules/system/src/Tests/Plugin/ContextPluginTest.php b/core/modules/system/src/Tests/Plugin/ContextPluginTest.php
index 3508689..0d1d6a2 100644
--- a/core/modules/system/src/Tests/Plugin/ContextPluginTest.php
+++ b/core/modules/system/src/Tests/Plugin/ContextPluginTest.php
@@ -8,7 +8,9 @@
 namespace Drupal\system\Tests\Plugin;
 
 use Drupal\Component\Plugin\Exception\ContextException;
+use Drupal\Core\Entity\Plugin\DataType\EntityAdapter;
 use Drupal\Core\Plugin\Context\ContextDefinition;
+use Drupal\node\Entity\NodeType;
 use Drupal\plugin_test\Plugin\MockBlockManager;
 use Drupal\simpletest\KernelTestBase;
 
@@ -26,6 +28,10 @@ class ContextPluginTest extends KernelTestBase {
    */
   function testContext() {
     $this->installEntitySchema('user');
+    $this->installEntitySchema('node');
+    $this->installEntitySchema('node_type');
+    $type = NodeType::create(['type' => 'page', 'name' => 'Page']);
+    $type->save();
 
     $name = $this->randomMachineName();
     $manager = new MockBlockManager();
@@ -61,14 +67,14 @@ function testContext() {
     }
 
     // Try to pass the wrong class type as a context value.
-    $plugin->setContextValue('user', $node);
+    $plugin->setContextValue('user', EntityAdapter::createFromEntity($node));
     $violations = $plugin->validateContexts();
     $this->assertTrue(!empty($violations), 'The provided context value does not pass validation.');
 
     // Set an appropriate context value and check to make sure its methods work
     // as expected.
     $user = entity_create('user', array('name' => $name));
-    $plugin->setContextValue('user', $user);
+    $plugin->setContextValue('user', EntityAdapter::createFromEntity($user));
 
     $this->assertEqual($plugin->getContextValue('user')->getUsername(), $user->getUsername());
     $this->assertEqual($user->label(), $plugin->getTitle());
@@ -79,14 +85,14 @@ function testContext() {
 
     // Test Complex compound context handling.
     $complex_plugin = $manager->createInstance('complex_context');
-    $complex_plugin->setContextValue('user', $user);
+    $complex_plugin->setContextValue('user', EntityAdapter::createFromEntity($user));
 
     // With only the user context set, try to get the context values.
     $values = $complex_plugin->getContextValues();
     $this->assertNull($values['node'], 'The node context is not yet set.');
     $this->assertNotNull($values['user'], 'The user context is set');
 
-    $complex_plugin->setContextValue('node', $node);
+    $complex_plugin->setContextValue('node', EntityAdapter::createFromEntity($node));
     $context_wrappers = $complex_plugin->getContexts();
     // Make sure what came out of the wrappers is good.
     $this->assertEqual($context_wrappers['user']->getContextValue()->label(), $user->label());
diff --git a/core/modules/system/tests/modules/condition_test/src/FormController.php b/core/modules/system/tests/modules/condition_test/src/FormController.php
index 4bf1230..0e3226e 100644
--- a/core/modules/system/tests/modules/condition_test/src/FormController.php
+++ b/core/modules/system/tests/modules/condition_test/src/FormController.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\condition_test;
 
+use Drupal\Core\Entity\Plugin\DataType\EntityAdapter;
 use Drupal\Core\Form\FormInterface;
 use Drupal\Core\Condition\ConditionManager;
 use Drupal\Core\Form\FormStateInterface;
@@ -70,7 +71,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
     }
 
     $article = Node::load(1);
-    $this->condition->setContextValue('node', $article);
+    $this->condition->setContextValue('node', EntityAdapter::createFromEntity($article));
     if ($this->condition->execute()) {
       drupal_set_message(t('Executed successfully.'));
     }
diff --git a/core/modules/system/tests/modules/condition_test/src/Tests/ConditionTestDualUserTest.php b/core/modules/system/tests/modules/condition_test/src/Tests/ConditionTestDualUserTest.php
index ab498ba..4825b7e 100644
--- a/core/modules/system/tests/modules/condition_test/src/Tests/ConditionTestDualUserTest.php
+++ b/core/modules/system/tests/modules/condition_test/src/Tests/ConditionTestDualUserTest.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\condition_test\Tests;
 
+use Drupal\Core\Entity\Plugin\DataType\EntityAdapter;
 use Drupal\Core\Plugin\Context\Context;
 use Drupal\Core\Plugin\Context\ContextDefinition;
 use Drupal\simpletest\KernelTestBase;
@@ -72,7 +73,7 @@ protected function doTestIdenticalUser() {
         'user2' => 'anonymous',
       ]);
     $definition = new ContextDefinition('entity:user');
-    $contexts['anonymous'] = (new Context($definition))->setContextValue($this->anonymous);
+    $contexts['anonymous'] = new Context($definition, EntityAdapter::createFromEntity($this->anonymous));
     \Drupal::service('context.handler')->applyContextMapping($condition, $contexts);
     $this->assertTrue($condition->execute());
   }
@@ -89,8 +90,8 @@ protected function doTestDifferentUser() {
         'user2' => 'authenticated',
       ]);
     $definition = new ContextDefinition('entity:user');
-    $contexts['anonymous'] = (new Context($definition))->setContextValue($this->anonymous);
-    $contexts['authenticated'] = (new Context($definition))->setContextValue($this->authenticated);
+    $contexts['anonymous'] = new Context($definition, EntityAdapter::createFromEntity($this->anonymous));
+    $contexts['authenticated'] = new Context($definition, EntityAdapter::createFromEntity($this->authenticated));
     \Drupal::service('context.handler')->applyContextMapping($condition, $contexts);
     $this->assertFalse($condition->execute());
   }
diff --git a/core/modules/system/tests/modules/condition_test/src/Tests/OptionalContextConditionTest.php b/core/modules/system/tests/modules/condition_test/src/Tests/OptionalContextConditionTest.php
index f455905..0681365 100644
--- a/core/modules/system/tests/modules/condition_test/src/Tests/OptionalContextConditionTest.php
+++ b/core/modules/system/tests/modules/condition_test/src/Tests/OptionalContextConditionTest.php
@@ -7,9 +7,11 @@
 
 namespace Drupal\condition_test\Tests;
 
+use Drupal\Core\Entity\Plugin\DataType\EntityAdapter;
 use Drupal\Core\Plugin\Context\Context;
 use Drupal\Core\Plugin\Context\ContextDefinition;
 use Drupal\node\Entity\Node;
+use Drupal\node\Entity\NodeType;
 use Drupal\simpletest\KernelTestBase;
 
 /**
@@ -58,6 +60,8 @@ protected function testContextNoValue() {
    * Tests with both contexts mapped to the same user.
    */
   protected function testContextAvailable() {
+    $type = NodeType::create(['type' => 'example', 'name' => 'Example']);
+    $type->save();
     /** @var \Drupal\Core\Condition\ConditionPluginBase $condition */
     $condition = \Drupal::service('plugin.manager.condition')
       ->createInstance('condition_test_optional_context')
@@ -66,7 +70,7 @@ protected function testContextAvailable() {
       ]);
     $definition = new ContextDefinition('entity:node');
     $node = Node::create(['type' => 'example']);
-    $contexts['node'] = (new Context($definition))->setContextValue($node);
+    $contexts['node'] = new Context($definition, EntityAdapter::createFromEntity($node));
     \Drupal::service('context.handler')->applyContextMapping($condition, $contexts);
     $this->assertFalse($condition->execute());
   }
diff --git a/core/modules/user/src/ContextProvider/CurrentUserContext.php b/core/modules/user/src/ContextProvider/CurrentUserContext.php
index 1a0f26c..5dc7bc3 100644
--- a/core/modules/user/src/ContextProvider/CurrentUserContext.php
+++ b/core/modules/user/src/ContextProvider/CurrentUserContext.php
@@ -9,6 +9,7 @@
 
 use Drupal\Core\Cache\CacheableMetadata;
 use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\Plugin\DataType\EntityAdapter;
 use Drupal\Core\Plugin\Context\Context;
 use Drupal\Core\Plugin\Context\ContextDefinition;
 use Drupal\Core\Plugin\Context\ContextProviderInterface;
@@ -55,8 +56,7 @@ public function __construct(AccountInterface $account, EntityManagerInterface $e
   public function getRuntimeContexts(array $unqualified_context_ids) {
     $current_user = $this->userStorage->load($this->account->id());
 
-    $context = new Context(new ContextDefinition('entity:user', $this->t('Current user')));
-    $context->setContextValue($current_user);
+    $context = new Context(new ContextDefinition('entity:user', $this->t('Current user')), EntityAdapter::createFromEntity($current_user));
     $cacheability = new CacheableMetadata();
     $cacheability->setCacheContexts(['user']);
     $context->addCacheableDependency($cacheability);
diff --git a/core/modules/user/src/Tests/Condition/UserRoleConditionTest.php b/core/modules/user/src/Tests/Condition/UserRoleConditionTest.php
index ef92e11..b9de36a 100644
--- a/core/modules/user/src/Tests/Condition/UserRoleConditionTest.php
+++ b/core/modules/user/src/Tests/Condition/UserRoleConditionTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\user\Tests\Condition;
 
 use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Core\Entity\Plugin\DataType\EntityAdapter;
 use Drupal\simpletest\KernelTestBase;
 use Drupal\user\Entity\Role;
 use Drupal\user\Entity\User;
@@ -113,7 +114,7 @@ public function testConditions() {
     /** @var $condition \Drupal\Core\Condition\ConditionInterface */
     $condition = $this->manager->createInstance('user_role')
       ->setConfig('roles', array(RoleInterface::AUTHENTICATED_ID => RoleInterface::AUTHENTICATED_ID))
-      ->setContextValue('user', $this->anonymous);
+      ->setContextValue('user', EntityAdapter::createFromEntity($this->anonymous));
     $this->assertFalse($condition->execute(), 'Anonymous users fail role checks for authenticated.');
     // Check for the proper summary.
     // Summaries require an extra space due to negate handling in summary().
@@ -133,7 +134,7 @@ public function testConditions() {
 
     // Set the context to the authenticated user and check that they also pass
     // against anonymous or authenticated roles.
-    $condition->setContextValue('user', $this->authenticated);
+    $condition->setContextValue('user', EntityAdapter::createFromEntity($this->authenticated));
     $this->assertTrue($condition->execute(), 'Authenticated users pass role checks for anonymous or authenticated.');
 
     // Set the role to just authenticated and recheck.
@@ -141,7 +142,7 @@ public function testConditions() {
     $this->assertTrue($condition->execute(), 'Authenticated users pass role checks for authenticated.');
 
     // Test Constructor injection.
-    $condition = $this->manager->createInstance('user_role', array('roles' => array(RoleInterface::AUTHENTICATED_ID => RoleInterface::AUTHENTICATED_ID), 'context' => array('user' => $this->authenticated)));
+    $condition = $this->manager->createInstance('user_role', array('roles' => array(RoleInterface::AUTHENTICATED_ID => RoleInterface::AUTHENTICATED_ID), 'context' => array('user' => EntityAdapter::createFromEntity($this->authenticated))));
     $this->assertTrue($condition->execute(), 'Constructor injection of context and configuration working as anticipated.');
 
     // Check the negated summary.
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php
index b59ed8a..f0f3ec0 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTest.php
@@ -48,8 +48,14 @@ public function setUp() {
 
     $this->typedDataManager = $this->getMockBuilder('Drupal\Core\TypedData\TypedDataManager')
       ->disableOriginalConstructor()
-      ->setMethods(array('create'))
       ->getMock();
+    $container = new Container();
+    $container->set('typed_data_manager', $this->typedDataManager);
+    $cache_context_manager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager')
+      ->disableOriginalConstructor()
+      ->getMock();
+    $container->set('cache_contexts_manager', $cache_context_manager);
+    \Drupal::setContainer($container);
   }
 
   /**
@@ -59,7 +65,6 @@ public function testDefaultValue() {
     $this->setUpDefaultValue();
 
     $context = new Context($this->contextDefinition);
-    $context->setTypedDataManager($this->typedDataManager);
     $this->assertEquals('test', $context->getContextValue());
   }
 
@@ -70,7 +75,6 @@ public function testDefaultDataValue() {
     $this->setUpDefaultValue();
 
     $context = new Context($this->contextDefinition);
-    $context->setTypedDataManager($this->typedDataManager);
     $this->assertEquals($this->typedData, $context->getContextData());
   }
 
@@ -83,10 +87,8 @@ public function testSetContextValueTypedData() {
       ->setMethods(array('getDefaultValue', 'getDataDefinition'))
       ->getMockForAbstractClass();
 
-    $context = new Context($this->contextDefinition);
-    $context->setTypedDataManager($this->typedDataManager);
     $typed_data = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
-    $context->setContextValue($typed_data);
+    $context = new Context($this->contextDefinition, $typed_data);
     $this->assertSame($typed_data, $context->getContextData());
   }
 
@@ -94,21 +96,14 @@ public function testSetContextValueTypedData() {
    * @covers ::setContextValue
    */
   public function testSetContextValueCacheableDependency() {
-    $container = new Container();
-    $cache_context_manager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager')
-      ->disableOriginalConstructor()
-      ->getMock();
-    $container->set('cache_contexts_manager', $cache_context_manager);
+    $cache_context_manager = \Drupal::service('cache_contexts_manager');
     $cache_context_manager->expects($this->any())
       ->method('validateTokens')
       ->with(['route'])
       ->willReturn(['route']);
-    \Drupal::setContainer($container);
 
     $this->contextDefinition = $this->getMock('Drupal\Core\Plugin\Context\ContextDefinitionInterface');
 
-    $context = new Context($this->contextDefinition);
-    $context->setTypedDataManager($this->typedDataManager);
     $cacheable_dependency = $this->getMock('Drupal\Tests\Core\Plugin\Context\TypedDataCacheableDependencyInterface');
     $cacheable_dependency->expects($this->once())
       ->method('getCacheTags')
@@ -120,7 +115,7 @@ public function testSetContextValueCacheableDependency() {
       ->method('getCacheMaxAge')
       ->willReturn(60);
 
-    $context->setContextValue($cacheable_dependency);
+    $context = new Context($this->contextDefinition, $cacheable_dependency);
     $this->assertSame($cacheable_dependency, $context->getContextData());
     $this->assertEquals(['node:1'], $context->getCacheTags());
     $this->assertEquals(['route'], $context->getCacheContexts());
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTypedDataTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTypedDataTest.php
index 49335a6..e684dd1 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTypedDataTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextTypedDataTest.php
@@ -50,11 +50,10 @@ public function testGetContextValue() {
     \Drupal::setContainer($container);
 
     $definition = new ContextDefinition('any');
-    $context = new Context($definition);
     $data_definition = DataDefinition::create('string');
     $this->typedData = new StringData($data_definition);
     $this->typedData->setValue('example string');
-    $context->setContextData($this->typedData);
+    $context = new Context($definition, $this->typedData);
     $value = $context->getContextValue();
     $this->assertSame($value, $this->typedData->getValue());
   }
diff --git a/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php b/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php
index 8900fdd..03099e5 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php
@@ -8,9 +8,12 @@
 namespace Drupal\Tests\Core\Plugin;
 
 use Drupal\Component\Plugin\ConfigurablePluginInterface;
+use Drupal\Core\Plugin\Context\Context;
 use Drupal\Core\Plugin\Context\ContextDefinition;
 use Drupal\Core\Plugin\Context\ContextHandler;
 use Drupal\Core\Plugin\ContextAwarePluginInterface;
+use Drupal\Core\TypedData\DataDefinition;
+use Drupal\Core\TypedData\Plugin\DataType\StringData;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -229,16 +232,20 @@ public function providerTestFilterPluginDefinitionsByContexts() {
    * @covers ::applyContextMapping
    */
   public function testApplyContextMapping() {
+    $context_hit_data = StringData::createInstance(DataDefinition::create('string'));
+    $context_hit_data->setValue('foo');
     $context_hit = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
     $context_hit->expects($this->atLeastOnce())
-      ->method('getContextValue')
-      ->will($this->returnValue(array('foo')));
+      ->method('getContextData')
+      ->will($this->returnValue($context_hit_data));
+    $context_miss_data = StringData::createInstance(DataDefinition::create('string'));
+    $context_miss_data->setValue('bar');
     $context_hit->expects($this->atLeastOnce())
       ->method('hasContextValue')
       ->willReturn(TRUE);
     $context_miss = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
     $context_miss->expects($this->never())
-      ->method('getContextValue');
+      ->method('getContextData');
 
     $contexts = array(
       'hit' => $context_hit,
@@ -256,7 +263,7 @@ public function testApplyContextMapping() {
       ->will($this->returnValue(array('hit' => $context_definition)));
     $plugin->expects($this->once())
       ->method('setContextValue')
-      ->with('hit', array('foo'));
+      ->with('hit', $context_hit_data);
 
     // Make sure that the cacheability metadata is passed to the plugin context.
     $plugin_context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
@@ -416,10 +423,12 @@ public function testApplyContextMappingNoValueNonRequired() {
    * @covers ::applyContextMapping
    */
   public function testApplyContextMappingConfigurableAssigned() {
+    $context_data = StringData::createInstance(DataDefinition::create('string'));
+    $context_data->setValue('foo');
     $context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
     $context->expects($this->atLeastOnce())
-      ->method('getContextValue')
-      ->will($this->returnValue(array('foo')));
+      ->method('getContextData')
+      ->will($this->returnValue($context_data));
     $context->expects($this->atLeastOnce())
       ->method('hasContextValue')
       ->willReturn(TRUE);
@@ -439,7 +448,7 @@ public function testApplyContextMappingConfigurableAssigned() {
       ->will($this->returnValue(array('hit' => $context_definition)));
     $plugin->expects($this->once())
       ->method('setContextValue')
-      ->with('hit', array('foo'));
+      ->with('hit', $context_data);
 
     // Make sure that the cacheability metadata is passed to the plugin context.
     $plugin_context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
