diff --git a/core/modules/migrate/tests/src/Unit/RowTest.php b/core/modules/migrate/tests/src/Unit/RowTest.php
index aa3a7d9..bb4a83e 100644
--- a/core/modules/migrate/tests/src/Unit/RowTest.php
+++ b/core/modules/migrate/tests/src/Unit/RowTest.php
@@ -85,13 +85,12 @@ public function testRowWithInvalidData() {
 
   /**
    * Tests source immutability after freeze.
-   *
-   * @expectedException \Exception
    */
   public function testSourceFreeze() {
     $row = new Row($this->testValues, $this->testSourceIds);
     $row->rehash();
     $this->assertSame($this->testHash, $row->getHash(), 'Correct hash.');
+    $this->setExpectedException(\Exception::class);
     $row->setSourceProperty('title', 'new title');
     $row->rehash();
     $this->assertSame($this->testHashMod, $row->getHash(), 'Hash changed correctly.');
diff --git a/core/tests/Drupal/KernelTests/Component/Utility/SafeMarkupKernelTest.php b/core/tests/Drupal/KernelTests/Component/Utility/SafeMarkupKernelTest.php
index cd42ad1..1a83e7d 100644
--- a/core/tests/Drupal/KernelTests/Component/Utility/SafeMarkupKernelTest.php
+++ b/core/tests/Drupal/KernelTests/Component/Utility/SafeMarkupKernelTest.php
@@ -107,12 +107,12 @@ public function providerTestSafeMarkupUri() {
 
   /**
    * @dataProvider providerTestSafeMarkupUriWithException
-   * @expectedException \InvalidArgumentException
    */
   public function testSafeMarkupUriWithExceptionUri($string, $uri) {
     // Should throw an \InvalidArgumentException, due to Uri::toString().
     $args = self::getSafeMarkupUriArgs($uri);
 
+    $this->setExpectedException(\InvalidArgumentException::class);
     SafeMarkup::format($string, $args);
   }
 
diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
index 8aa9d9a..2f81ecb 100644
--- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
+++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
@@ -616,8 +616,6 @@ public function testResolveServicesAndParametersForInvalidArgument() {
    * @covers ::get
    * @covers ::createService
    * @covers ::resolveServicesAndParameters
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
    */
   public function testResolveServicesAndParametersForInvalidArguments() {
     // In case the machine-optimized format is not used, we need to simulate the
@@ -625,6 +623,7 @@ public function testResolveServicesAndParametersForInvalidArguments() {
     if (!$this->machineFormat) {
       throw new InvalidArgumentException('Simulating the test failure.');
     }
+    $this->setExpectedException(InvalidArgumentException::class);
     $this->container->get('invalid_arguments_service');
   }
 
diff --git a/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php b/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php
index 878bbfd..9fe48f2 100644
--- a/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php
@@ -121,9 +121,6 @@ public function testGetArgumentOrder() {
    * Tests getArgument() with a wildcard parameter with no typehint.
    *
    * Without the typehint, the wildcard object will not be passed to the callable.
-   *
-   * @expectedException \RuntimeException
-   * @expectedExceptionMessage requires a value for the "$route" argument.
    */
   public function testGetWildcardArgumentNoTypehint() {
     $a = $this->getMock('\Drupal\Tests\Component\Utility\TestInterface1');
@@ -132,6 +129,7 @@ public function testGetWildcardArgumentNoTypehint() {
 
     $callable = function($route) {};
     $arguments = $resolver->getArguments($callable);
+    $this->setExpectedException(\RuntimeException::class, 'requires a value for the "$route" argument.');
     $this->assertNull($arguments);
   }
 
@@ -152,9 +150,6 @@ public function testGetArgumentRouteNoTypehintAndValue() {
 
   /**
    * Tests handleUnresolvedArgument() for a scalar argument.
-   *
-   * @expectedException \RuntimeException
-   * @expectedExceptionMessage requires a value for the "$foo" argument.
    */
   public function testHandleNotUpcastedArgument() {
     $objects = ['foo' => 'bar'];
@@ -163,20 +158,19 @@ public function testHandleNotUpcastedArgument() {
 
     $callable = function(\stdClass $foo) {};
     $arguments = $resolver->getArguments($callable);
+    $this->setExpectedException(\RuntimeException::class, 'requires a value for the "$foo" argument.');
     $this->assertNull($arguments);
   }
 
   /**
    * Tests handleUnresolvedArgument() for missing arguments.
    *
-   * @expectedException \RuntimeException
-   * @expectedExceptionMessage requires a value for the "$foo" argument.
-   *
    * @dataProvider providerTestHandleUnresolvedArgument
    */
   public function testHandleUnresolvedArgument($callable) {
     $resolver = new ArgumentsResolver([], [], []);
     $arguments = $resolver->getArguments($callable);
+    $this->setExpectedException(\RuntimeException::class, 'requires a value for the "$foo" argument.');
     $this->assertNull($arguments);
   }
 
diff --git a/core/tests/Drupal/Tests/Component/Utility/RandomTest.php b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php
index e8cc6f6..b122c3a 100644
--- a/core/tests/Drupal/Tests/Component/Utility/RandomTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php
@@ -57,12 +57,12 @@ public function testRandomNamesUniqueness() {
    * Tests infinite loop prevention whilst generating random names.
    *
    * @covers ::name
-   * @expectedException \RuntimeException
    */
   public function testRandomNameException() {
     // There are fewer than 100 possibilities so an exception should occur to
     // prevent infinite loops.
     $random = new Random();
+    $this->setExpectedException(\RuntimeException::class);
     for ($i = 0; $i <= 100; $i++) {
       $str = $random->name(1, TRUE);
       $names[$str] = TRUE;
@@ -73,12 +73,12 @@ public function testRandomNameException() {
    * Tests infinite loop prevention whilst generating random strings.
    *
    * @covers ::string
-   * @expectedException \RuntimeException
    */
   public function testRandomStringException() {
     // There are fewer than 100 possibilities so an exception should occur to
     // prevent infinite loops.
     $random = new Random();
+    $this->setExpectedException(\RuntimeException::class);
     for ($i = 0; $i <= 100; $i++) {
       $str = $random->string(1, TRUE);
       $names[$str] = TRUE;
diff --git a/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php b/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php
index ca8acfc..67c7d98 100644
--- a/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php
+++ b/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php
@@ -15,12 +15,11 @@ class BreadcrumbTest extends UnitTestCase {
 
   /**
    * @covers ::setLinks
-   * @expectedException \LogicException
-   * @expectedExceptionMessage Once breadcrumb links are set, only additional breadcrumb links can be added.
    */
   public function testSetLinks() {
     $breadcrumb = new Breadcrumb();
     $breadcrumb->setLinks([new Link('Home', Url::fromRoute('<front>'))]);
+    $this->setExpectedException(\LogicException::class, 'Once breadcrumb links are set, only additional breadcrumb links can be added.');
     $breadcrumb->setLinks([new Link('None', Url::fromRoute('<none>'))]);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php
index 4a6eae7..ff262c4 100644
--- a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php
@@ -35,13 +35,12 @@ public function testSet() {
 
   /**
    * @covers ::set
-   * @expectedException \InvalidArgumentException
-   * @expectedExceptionMessage Service ID names must be lowercase: Bar
    */
   public function testSetException() {
     $container = new ContainerBuilder();
     $class = new BarClass();
     $container->set('Bar', $class);
+    $this->setExpectedException(\InvalidArgumentException::class, 'Service ID names must be lowercase: Bar');
     $this->assertNotEquals('bar', $class->_serviceId);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php
index 4942701..60e6d42 100644
--- a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php
@@ -5,6 +5,7 @@
 use Drupal\Core\Config\Entity\ConfigEntityInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityMalformedException;
 use Drupal\Core\Language\Language;
 use Drupal\Tests\UnitTestCase;
 use Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage;
@@ -439,15 +440,13 @@ public function testSaveContentEntity() {
   /**
    * @covers ::save
    * @covers ::doSave
-   *
-   * @expectedException \Drupal\Core\Entity\EntityMalformedException
-   * @expectedExceptionMessage The entity does not have an ID.
    */
   public function testSaveInvalid() {
     $this->setUpKeyValueEntityStorage();
 
     $entity = $this->getMockEntity('Drupal\Core\Config\Entity\ConfigEntityBase');
     $this->entityStorage->save($entity);
+    $this->setExpectedException(EntityMalformedException::class, 'The entity does not have an ID.');
     $this->keyValueStore->expects($this->never())
       ->method('has');
     $this->keyValueStore->expects($this->never())
diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php
index 3f80e4d..fb0e67b 100644
--- a/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php
+++ b/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php
@@ -115,8 +115,6 @@ public static function providerTestDestinationRedirect() {
 
   /**
    * @dataProvider providerTestDestinationRedirectToExternalUrl
-   *
-   * @expectedException \PHPUnit_Framework_Error
    */
   public function testDestinationRedirectToExternalUrl($request, $expected) {
     $dispatcher = new EventDispatcher();
@@ -128,6 +126,7 @@ public function testDestinationRedirectToExternalUrl($request, $expected) {
     $event = new FilterResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST, $response);
     $dispatcher->dispatch(KernelEvents::RESPONSE, $event);
 
+    $this->setExpectedException(\PHPUnit_Framework_Error::class);
     $this->assertEquals(400, $event->getResponse()->getStatusCode());
   }
 
@@ -165,8 +164,6 @@ public function providerTestDestinationRedirectToExternalUrl() {
   }
 
   /**
-   * @expectedException \PHPUnit_Framework_Error
-   *
    * @dataProvider providerTestDestinationRedirectWithInvalidUrl
    */
   public function testDestinationRedirectWithInvalidUrl(Request $request) {
@@ -179,6 +176,7 @@ public function testDestinationRedirectWithInvalidUrl(Request $request) {
     $event = new FilterResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST, $response);
     $dispatcher->dispatch(KernelEvents::RESPONSE, $event);
 
+    $this->setExpectedException(\PHPUnit_Framework_Error::class);
     $this->assertEquals(400, $event->getResponse()->getStatusCode());
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php
index 67e7a86..94d24af 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php
@@ -158,13 +158,12 @@ public function testIsCached($cache) {
    * @dataProvider providerSingleBooleanArgument
    *
    * @param bool $cache
-   *
-   * @expectedException \LogicException
    */
   public function testSetCachedWithLogicException($cache) {
     $this->decoratedFormState->setCached($cache)
       ->willThrow(\LogicException::class);
 
+    $this->setExpectedException(\LogicException::class);
     $this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setCached($cache));
   }
 
diff --git a/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php b/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php
index 1575ac1..4fe6bb7 100644
--- a/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php
+++ b/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php
@@ -72,7 +72,6 @@ public function testNullRuleChain() {
   /**
    * Asserts that check() throws an exception if a rule returns an invalid value.
    *
-   * @expectedException \UnexpectedValueException
    * @dataProvider providerChainExceptionOnInvalidReturnValue
    * @covers ::check
    */
@@ -86,6 +85,7 @@ public function testChainExceptionOnInvalidReturnValue($return_value) {
     $this->policy->addPolicy($rule);
 
     $actual_result = $this->policy->check($this->response, $this->request);
+    $this->setExpectedException(\UnexpectedValueException::class);
     $this->assertSame(NULL, $actual_result);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php b/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php
index bffbd22..7270001 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php
@@ -31,8 +31,6 @@ protected function setUpRenderRecursionComplexElements() {
    * @covers ::renderRoot
    * @covers ::render
    * @covers ::doRender
-   *
-   * @expectedException \LogicException
    */
   public function testRenderRecursionWithNestedRenderRoot() {
     list($complex_child_markup, $parent_markup, $complex_child_template) = $this->setUpRenderRecursionComplexElements();
@@ -44,6 +42,7 @@ public function testRenderRecursionWithNestedRenderRoot() {
       $renderer->renderRoot($complex_child);
     };
 
+    $this->setExpectedException(\LogicException::class);
     $page = [
       'content' => [
         '#pre_render' => [
diff --git a/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php b/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php
index d73513e..611a2ed 100644
--- a/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php
@@ -87,8 +87,6 @@ public function testMatchRequestAllowed() {
 
   /**
    * Tests the matchRequest() function for access denied.
-   *
-   * @expectedException \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
    */
   public function testMatchRequestDenied() {
     $this->setupRouter();
@@ -99,6 +97,7 @@ public function testMatchRequestDenied() {
       ->with($request)
       ->willReturn($access_result);
     $parameters = $this->router->matchRequest($request);
+    $this->setExpectedException(AccessDeniedHttpException::class);
     $expected = [
       AccessAwareRouterInterface::ACCESS_RESULT => $access_result,
     ];
diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php
index 3ed2b3d..04f4d58 100644
--- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php
+++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php
@@ -93,14 +93,12 @@ public function testIsStringAssertion() {
   }
 
   /**
-   * @expectedException \InvalidArgumentException
-   * @expectedExceptionMessage $string ("foo") must be a string.
-   *
    * @covers ::__construct
    */
   public function testIsStringAssertionWithFormattableMarkup() {
     $translation = $this->getStringTranslationStub();
     $formattable_string = new FormattableMarkup('@bar', ['@bar' => 'foo']);
+    $this->setExpectedException(\InvalidArgumentException::class, '$string ("foo") must be a string.');
     new TranslatableMarkup($formattable_string);
   }
 
