diff --git a/core/modules/system/lib/Drupal/system/Tests/Validation/ComplexDataConstraintValidatorTest.php b/core/modules/system/lib/Drupal/system/Tests/Validation/ComplexDataConstraintValidatorTest.php
new file mode 100644
index 0000000..05ef958
--- /dev/null
+++ b/core/modules/system/lib/Drupal/system/Tests/Validation/ComplexDataConstraintValidatorTest.php
@@ -0,0 +1,74 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal\system\Tests\Validation\ComplexDataConstraintValidatorTest.
+ */
+
+namespace Drupal\system\Tests\Validation;
+
+use Drupal\simpletest\DrupalUnitTestBase;
+
+/**
+ * Tests the ComplexData validation constraint validator.
+ */
+class ComplexDataConstraintValidatorTest extends DrupalUnitTestBase {
+
+  /**
+   * The typed data manager to use.
+   *
+   * @var \Drupal\Core\TypedData\TypedDataManager
+   */
+  protected $typedData;
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Tests ComplexData validation constraint',
+      'description' => 'Tests ComplexData validation constraint with both valid and invalid values for a key',
+      'group' => 'Validation',
+    );
+  }
+
+  public function setUp() {
+    parent::setUp();
+
+    $this->typedData = $this->container->get('typed_data');
+  }
+
+  /**
+   * Tests the ComplexData validation constraint validator by creating a
+   * typedData map definition with a ComplexData constraint containing one
+   * AllowedValues constraint, and then by tring to create a typedData object
+   * with both an allowed and a dissalowed value.
+   */
+  public function testValidation() {
+    // Create a definition that specifies some ComplexData.
+    $definition = array(
+      'type' => 'map',
+      'constraints' => array(
+        'ComplexData' => array(
+          'key' => array(
+            'AllowedValues' => array(1,2,3)
+          ),
+        ),
+      ),
+    );
+
+    // Test the validation.
+    $typed_data = $this->typedData->create($definition, array('key' => 1));
+    $violations = $typed_data->validate();
+    $this->assertEqual($violations->count(), 0, 'Validation passed for correct value.');
+
+    // Test the validation when an invalid value is passed.
+    $typed_data = $this->typedData->create($definition, array('key' => 4));
+    $violations = $typed_data->validate();
+    $this->assertEqual($violations->count(), 1, 'Validation failed for incorrect value.');
+
+    // Make sure the information provided by a violation is correct.
+    $violation = $violations[0];
+    $this->assertEqual($violation->getMessage(), t('The value you selected is not a valid choice.'), 'The message for invalid value is correct.');
+    $this->assertEqual($violation->getRoot(), $typed_data, 'Violation root is correct.');
+    $this->assertEqual($violation->getInvalidValue(), 4, 'The invalid value is set correctly in the violation.');
+  }
+
+}
