diff --git a/core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php b/core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php
index 9123129..1a991b9 100644
--- a/core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php
+++ b/core/modules/big_pipe/tests/src/Unit/Render/BigPipeResponseAttachmentsProcessorTest.php
@@ -28,13 +28,12 @@ class BigPipeResponseAttachmentsProcessorTest extends UnitTestCase {
    * @covers ::processAttachments
    *
    * @dataProvider nonHtmlResponseProvider
-   *
-   * @expectedException \AssertionError
    */
   public function testNonHtmlResponse($response_class) {
     $big_pipe_response_attachments_processor = $this->createBigPipeResponseAttachmentsProcessor($this->prophesize(AttachmentsResponseProcessorInterface::class));
 
     $non_html_response = new $response_class();
+    $this->setExpectedException('\AssertionError'); // ALGO COVER (method)
     $big_pipe_response_attachments_processor->processAttachments($non_html_response);
   }
 
diff --git a/core/modules/contact/tests/src/Unit/MailHandlerTest.php b/core/modules/contact/tests/src/Unit/MailHandlerTest.php
index 9e5c82c..b650f2f 100644
--- a/core/modules/contact/tests/src/Unit/MailHandlerTest.php
+++ b/core/modules/contact/tests/src/Unit/MailHandlerTest.php
@@ -94,9 +94,6 @@ class MailHandlerTest extends UnitTestCase {
   /**
    * Tests the children() method with an invalid key.
    *
-   * @expectedException \Drupal\contact\MailHandlerException
-   * @expectedExceptionMessage Unable to determine message recipient
-   *
    * @covers ::sendMailMessages
    */
   public function testInvalidRecipient() {
@@ -121,6 +118,7 @@ class MailHandlerTest extends UnitTestCase {
     $sender->expects($this->once())
       ->method('isAnonymous')
       ->willReturn(FALSE);
+    $this->setExpectedException('\Drupal\contact\MailHandlerException', 'Unable to determine message recipient'); // ALGO COVER (method)
     $this->contactMailHandler->sendMailMessages($message, $sender);
   }
 
diff --git a/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php b/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php
index 3f687d4..1cdc69f 100644
--- a/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php
+++ b/core/modules/field/tests/src/Unit/FieldConfigEntityUnitTest.php
@@ -160,9 +160,6 @@ class FieldConfigEntityUnitTest extends UnitTestCase {
 
   /**
    * Test that invalid bundles are handled.
-   *
-   * @expectedException \LogicException
-   * @expectedExceptionMessage Missing bundle entity, entity type bundle_entity_type, entity id test_bundle_not_exists.
    */
   public function testCalculateDependenciesIncorrectBundle() {
     $storage = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityStorageInterface');
@@ -209,6 +206,7 @@ class FieldConfigEntityUnitTest extends UnitTestCase {
       'bundle' => 'test_bundle_not_exists',
       'field_type' => 'test_field',
     ), $this->entityTypeId);
+    $this->setExpectedException('\LogicException', 'Missing bundle entity, entity type bundle_entity_type, entity id test_bundle_not_exists.'); // ALGO LAST
     $field->calculateDependencies();
   }
 
diff --git a/core/modules/hal/tests/src/Unit/FieldItemNormalizerDenormalizeExceptionsUnitTest.php b/core/modules/hal/tests/src/Unit/FieldItemNormalizerDenormalizeExceptionsUnitTest.php
index 550c185..a27dd68 100644
--- a/core/modules/hal/tests/src/Unit/FieldItemNormalizerDenormalizeExceptionsUnitTest.php
+++ b/core/modules/hal/tests/src/Unit/FieldItemNormalizerDenormalizeExceptionsUnitTest.php
@@ -17,12 +17,12 @@ class FieldItemNormalizerDenormalizeExceptionsUnitTest extends NormalizerDenorma
    *   Context for FieldItemNormalizer::denormalize().
    *
    * @dataProvider providerNormalizerDenormalizeExceptions
-   * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
    */
   public function testFieldItemNormalizerDenormalizeExceptions($context) {
     $field_item_normalizer = new FieldItemNormalizer();
     $data = array();
     $class = array();
+    $this->setExpectedException('\Symfony\Component\Serializer\Exception\InvalidArgumentException'); // ALGO LAST
     $field_item_normalizer->denormalize($data, $class, NULL, $context);
   }
 
diff --git a/core/modules/hal/tests/src/Unit/FieldNormalizerDenormalizeExceptionsUnitTest.php b/core/modules/hal/tests/src/Unit/FieldNormalizerDenormalizeExceptionsUnitTest.php
index a257209..37de828 100644
--- a/core/modules/hal/tests/src/Unit/FieldNormalizerDenormalizeExceptionsUnitTest.php
+++ b/core/modules/hal/tests/src/Unit/FieldNormalizerDenormalizeExceptionsUnitTest.php
@@ -17,12 +17,12 @@ class FieldNormalizerDenormalizeExceptionsUnitTest extends NormalizerDenormalize
    *   Context for FieldNormalizer::denormalize().
    *
    * @dataProvider providerNormalizerDenormalizeExceptions
-   * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
    */
   public function testFieldNormalizerDenormalizeExceptions($context) {
     $field_item_normalizer = new FieldNormalizer();
     $data = array();
     $class = array();
+    $this->setExpectedException('\Symfony\Component\Serializer\Exception\InvalidArgumentException'); // ALGO LAST
     $field_item_normalizer->denormalize($data, $class, NULL, $context);
   }
 
diff --git a/core/modules/locale/tests/src/Unit/StringBaseTest.php b/core/modules/locale/tests/src/Unit/StringBaseTest.php
index 58ea0ff..9d37116 100644
--- a/core/modules/locale/tests/src/Unit/StringBaseTest.php
+++ b/core/modules/locale/tests/src/Unit/StringBaseTest.php
@@ -13,22 +13,20 @@ class StringBaseTest extends UnitTestCase {
 
   /**
    * @covers ::save
-   * @expectedException \Drupal\locale\StringStorageException
-   * @expectedExceptionMessage The string cannot be saved because its not bound to a storage: test
    */
   public function testSaveWithoutStorage() {
     $string = new SourceString(['source' => 'test']);
+    $this->setExpectedException('\Drupal\locale\StringStorageException', 'The string cannot be saved because its not bound to a storage: test'); // ALGO COVER (method)
     $string->save();
   }
 
 
   /**
    * @covers ::delete
-   * @expectedException \Drupal\locale\StringStorageException
-   * @expectedExceptionMessage The string cannot be deleted because its not bound to a storage: test
    */
   public function testDeleteWithoutStorage() {
     $string = new SourceString(['lid' => 1, 'source' => 'test']);
+    $this->setExpectedException('\Drupal\locale\StringStorageException', 'The string cannot be deleted because its not bound to a storage: test'); // ALGO COVER (method)
     $string->delete();
   }
 
diff --git a/core/modules/migrate/tests/src/Kernel/process/CopyFileTest.php b/core/modules/migrate/tests/src/Kernel/process/CopyFileTest.php
index 427d413..7a253b3 100644
--- a/core/modules/migrate/tests/src/Kernel/process/CopyFileTest.php
+++ b/core/modules/migrate/tests/src/Kernel/process/CopyFileTest.php
@@ -7,6 +7,7 @@ use Drupal\KernelTests\Core\File\FileTestBase;
 use Drupal\migrate\MigrateExecutableInterface;
 use Drupal\migrate\Plugin\migrate\process\FileCopy;
 use Drupal\migrate\Row;
+use Drupal\migrate\MigrateException;
 
 /**
  * Tests the copy_file process plugin.
@@ -135,13 +136,10 @@ class CopyFileTest extends FileTestBase {
 
   /**
    * Test that non-existent files throw an exception.
-   *
-   * @expectedException \Drupal\migrate\MigrateException
-   *
-   * @expectedExceptionMessage File '/non/existent/file' does not exist
    */
   public function testNonExistentSourceFile() {
     $source = '/non/existent/file';
+    $this->setExpectedException(MigrateException::class, "File '/non/existent/file' does not exist"); // ALGO LAST
     $this->doImport($source, 'public://wontmatter.jpg');
   }
 
diff --git a/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php b/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php
index ee75e45..9e3e6d4 100644
--- a/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php
+++ b/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php
@@ -8,6 +8,7 @@ use Drupal\migrate\Plugin\migrate\process\FileCopy;
 use Drupal\migrate\MigrateExecutableInterface;
 use Drupal\migrate\Plugin\MigrateProcessInterface;
 use Drupal\migrate\Row;
+use Drupal\migrate\MigrateException;
 
 /**
  * Tests the file_copy process plugin.
@@ -110,13 +111,10 @@ class FileCopyTest extends FileTestBase {
 
   /**
    * Test that non-existent files throw an exception.
-   *
-   * @expectedException \Drupal\migrate\MigrateException
-   *
-   * @expectedExceptionMessage File '/non/existent/file' does not exist
    */
   public function testNonExistentSourceFile() {
     $source = '/non/existent/file';
+    $this->setExpectedException(MigrateException::class, "File '/non/existent/file' does not exist"); // ALGO LAST
     $this->doTransform($source, 'public://wontmatter.jpg');
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php b/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php
index 4a462e9..69d10d2 100644
--- a/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrateSourceTest.php
@@ -17,6 +17,7 @@ use Drupal\migrate\MigrateSkipRowException;
 use Drupal\migrate\Plugin\migrate\source\SourcePluginBase;
 use Drupal\migrate\Plugin\MigrateIdMapInterface;
 use Drupal\migrate\Row;
+use Drupal\migrate\MigrateException;
 
 /**
  * @coversDefaultClass \Drupal\migrate\Plugin\migrate\source\SourcePluginBase
@@ -149,10 +150,10 @@ class MigrateSourceTest extends MigrateTestCase {
 
   /**
    * @covers ::__construct
-   * @expectedException \Drupal\migrate\MigrateException
    */
   public function testHighwaterTrackChangesIncompatible() {
     $source_config = ['track_changes' => TRUE, 'high_water_property' => ['name' => 'something']];
+    $this->setExpectedException(MigrationException::class); // ALGO LAST
     $this->getSource($source_config);
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/MigrationTest.php b/core/modules/migrate/tests/src/Unit/MigrationTest.php
index 57ff64c..7e55b84 100644
--- a/core/modules/migrate/tests/src/Unit/MigrationTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrationTest.php
@@ -27,9 +27,6 @@ class MigrationTest extends UnitTestCase {
    * Tests checking requirements for source plugins.
    *
    * @covers ::checkRequirements
-   *
-   * @expectedException \Drupal\migrate\Exception\RequirementsException
-   * @expectedExceptionMessage Missing source requirement
    */
   public function testRequirementsForSourcePlugin() {
     $migration = new TestMigration();
@@ -43,6 +40,7 @@ class MigrationTest extends UnitTestCase {
     $migration->setSourcePlugin($source_plugin);
     $migration->setDestinationPlugin($destination_plugin);
 
+    $this->setExpectedException('\Drupal\migrate\Exception\RequirementsException', 'Missing source requirement'); // ALGO COVER (method)
     $migration->checkRequirements();
   }
 
@@ -50,9 +48,6 @@ class MigrationTest extends UnitTestCase {
    * Tests checking requirements for destination plugins.
    *
    * @covers ::checkRequirements
-   *
-   * @expectedException \Drupal\migrate\Exception\RequirementsException
-   * @expectedExceptionMessage Missing destination requirement
    */
   public function testRequirementsForDestinationPlugin() {
     $migration = new TestMigration();
@@ -66,6 +61,7 @@ class MigrationTest extends UnitTestCase {
     $migration->setSourcePlugin($source_plugin);
     $migration->setDestinationPlugin($destination_plugin);
 
+    $this->setExpectedException('\Drupal\migrate\Exception\RequirementsException', 'Missing destination requirement'); // ALGO COVER (method)
     $migration->checkRequirements();
   }
 
@@ -73,9 +69,6 @@ class MigrationTest extends UnitTestCase {
    * Tests checking requirements for destination plugins.
    *
    * @covers ::checkRequirements
-   *
-   * @expectedException \Drupal\migrate\Exception\RequirementsException
-   * @expectedExceptionMessage Missing migrations test_a, test_c
    */
   public function testRequirementsForMigrations() {
     $migration = new TestMigration();
@@ -112,6 +105,7 @@ class MigrationTest extends UnitTestCase {
       ->with(['test_a', 'test_b', 'test_c', 'test_d'])
       ->willReturn(['test_b' => $migration_b, 'test_c' => $migration_c, 'test_d' => $migration_d]);
 
+    $this->setExpectedException('\Drupal\migrate\Exception\RequirementsException', 'Missing migrations test_a, test_c'); // ALGO COVER (method)
     $migration->checkRequirements();
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php
index e5d63c4..442e6e7 100644
--- a/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php
+++ b/core/modules/migrate/tests/src/Unit/Plugin/migrate/destination/EntityContentBaseTest.php
@@ -18,6 +18,7 @@ use Drupal\migrate\Plugin\migrate\destination\EntityContentBase;
 use Drupal\migrate\Plugin\MigrateIdMapInterface;
 use Drupal\migrate\Row;
 use Drupal\Tests\UnitTestCase;
+use Drupal\migrate\MigrateException;
 
 /**
  * Tests base entity migration destination functionality.
@@ -84,8 +85,6 @@ class EntityContentBaseTest extends UnitTestCase {
    * Test row skipping when we can't get an entity to save.
    *
    * @covers ::import
-   * @expectedException \Drupal\migrate\MigrateException
-   * @expectedExceptionMessage Unable to get entity
    */
   public function testImportEntityLoadFailure() {
     $bundles = [];
@@ -96,14 +95,12 @@ class EntityContentBaseTest extends UnitTestCase {
       $this->entityManager->reveal(),
       $this->prophesize(FieldTypePluginManagerInterface::class)->reveal());
     $destination->setEntity(FALSE);
+    $this->setExpectedException(MigrateException::class, 'Unable to get entity'); // ALGO COVER (method)
     $destination->import(new Row());
   }
 
   /**
    * Test that translation destination fails for untranslatable entities.
-   *
-   * @expectedException \Drupal\migrate\MigrateException
-   * @expectedExceptionMessage This entity type does not support translation
    */
   public function testUntranslatable() {
     // An entity type without a language.
@@ -125,6 +122,7 @@ class EntityContentBaseTest extends UnitTestCase {
       $this->entityManager->reveal(),
       $this->prophesize(FieldTypePluginManagerInterface::class)->reveal()
     );
+    $this->setExpectedException(MigrateException::class, 'This entity type does not support translation'); // ALGO LAST
     $destination->getIds();
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/RowTest.php b/core/modules/migrate/tests/src/Unit/RowTest.php
index ec04f82..e70d1be 100644
--- a/core/modules/migrate/tests/src/Unit/RowTest.php
+++ b/core/modules/migrate/tests/src/Unit/RowTest.php
@@ -73,23 +73,21 @@ class RowTest extends UnitTestCase {
 
   /**
    * Tests object creation: invalid values.
-   *
-   * @expectedException \Exception
    */
   public function testRowWithInvalidData() {
     $invalid_values = array(
       'title' => 'node X',
     );
+    $this->setExpectedException('\Exception'); // ALGO LAST
     $row = new Row($invalid_values, $this->testSourceIds);
   }
 
   /**
    * Tests source immutability after freeze.
-   *
-   * @expectedException \Exception
    */
   public function testSourceFreeze() {
     $row = new Row($this->testValues, $this->testSourceIds);
+    $this->setExpectedException('\Exception'); // ALGO ASSERT
     $row->rehash();
     $this->assertSame($this->testHash, $row->getHash(), 'Correct hash.');
     $row->setSourceProperty('title', 'new title');
@@ -101,13 +99,11 @@ class RowTest extends UnitTestCase {
 
   /**
    * Tests setting on a frozen row.
-   *
-   * @expectedException \Exception
-   * @expectedExceptionMessage The source is frozen and can't be changed any more
    */
   public function testSetFrozenRow() {
     $row = new Row($this->testValues, $this->testSourceIds);
     $row->freezeSource();
+    $this->setExpectedException('\Exception', "The source is frozen and can't be changed any more"); // ALGO LAST
     $row->setSourceProperty('title', 'new title');
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/process/ConcatTest.php b/core/modules/migrate/tests/src/Unit/process/ConcatTest.php
index 1d0d4c3..b38ffe9 100644
--- a/core/modules/migrate/tests/src/Unit/process/ConcatTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/ConcatTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\Tests\migrate\Unit\process;
 
 use Drupal\migrate\Plugin\migrate\process\Concat;
+use Drupal\migrate\MigrateException;
 
 /**
  * Tests the concat process plugin.
@@ -34,10 +35,9 @@ class ConcatTest extends MigrateProcessTestCase {
 
   /**
    * Test concat fails properly on non-arrays.
-   *
-   * @expectedException \Drupal\migrate\MigrateException
    */
   public function testConcatWithNonArray() {
+    $this->setExpectedException(MigrationException::class); // ALGO ONE
     $this->plugin->transform('foo', $this->migrateExecutable, $this->row, 'destinationproperty');
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/process/ExplodeTest.php b/core/modules/migrate/tests/src/Unit/process/ExplodeTest.php
index 3245e60..dac2270 100644
--- a/core/modules/migrate/tests/src/Unit/process/ExplodeTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/ExplodeTest.php
@@ -4,6 +4,7 @@ namespace Drupal\Tests\migrate\Unit\process;
 
 use Drupal\migrate\Plugin\migrate\process\Explode;
 use Drupal\migrate\Plugin\migrate\process\Concat;
+use Drupal\migrate\MigrateException;
 
 /**
  * Tests the Explode process plugin.
@@ -53,24 +54,18 @@ class ExplodeTest extends MigrateProcessTestCase {
 
   /**
    * Test explode fails properly on non-strings.
-   *
-   * @expectedException \Drupal\migrate\MigrateException
-   *
-   * @expectedExceptionMessage is not a string
    */
   public function testExplodeWithNonString() {
+    $this->setExpectedException(MigrateException::class, 'is not a string'); // ALGO ONE
     $this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
   }
 
   /**
    * Test explode fails with empty delimiter.
-   *
-   * @expectedException \Drupal\migrate\MigrateException
-   *
-   * @expectedExceptionMessage delimiter is empty
    */
   public function testExplodeWithEmptyDelimiter() {
     $plugin = new Explode(['delimiter' => ''], 'map', []);
+    $this->setExpectedException(MigrateException::class, 'delimiter is empty'); // ALGO LAST
     $plugin->transform('foo,bar', $this->migrateExecutable, $this->row, 'destinationproperty');
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/process/ExtractTest.php b/core/modules/migrate/tests/src/Unit/process/ExtractTest.php
index 26c2cfe..07cf2c1 100644
--- a/core/modules/migrate/tests/src/Unit/process/ExtractTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/ExtractTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\migrate\Unit\process;
 
 use Drupal\migrate\Plugin\migrate\process\Extract;
+use Drupal\migrate\MigrateException;
 
 /**
  * @coversDefaultClass \Drupal\migrate\Plugin\migrate\process\Extract
@@ -29,21 +30,17 @@ class ExtractTest extends MigrateProcessTestCase {
 
   /**
    * Tests invalid input.
-   *
-   * @expectedException \Drupal\migrate\MigrateException
-   * @expectedExceptionMessage Input should be an array.
    */
   public function testExtractFromString() {
+    $this->setExpectedException(MigrateException::class, 'Input should be an array.'); // ALGO ONE
     $this->plugin->transform('bar', $this->migrateExecutable, $this->row, 'destinationproperty');
   }
 
   /**
    * Tests unsuccessful extraction.
-   *
-   * @expectedException \Drupal\migrate\MigrateException
-   * @expectedExceptionMessage Array index missing, extraction failed.
    */
   public function testExtractFail() {
+    $this->setExpectedException(MigrateException::class, 'Array index missing, extraction failed.'); // ALGO ONE
     $this->plugin->transform(array('bar' => 'foo'), $this->migrateExecutable, $this->row, 'destinationproperty');
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/process/MigrationTest.php b/core/modules/migrate/tests/src/Unit/process/MigrationTest.php
index 4eb52da..31f5dd0 100644
--- a/core/modules/migrate/tests/src/Unit/process/MigrationTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/MigrationTest.php
@@ -89,8 +89,6 @@ class MigrationTest extends MigrateProcessTestCase {
 
   /**
    * Tests that processing is skipped when the input value is empty.
-  *
-   * @expectedException \Drupal\migrate\MigrateSkipProcessException
    */
   public function testSkipOnEmpty() {
     $migration_plugin = $this->prophesize(MigrationInterface::class);
@@ -102,6 +100,7 @@ class MigrationTest extends MigrateProcessTestCase {
     ];
     $migration_plugin->id()->willReturn(uniqid());
     $migration = new Migration($configuration, 'migration', [], $migration_plugin->reveal(), $migration_plugin_manager->reveal(), $process_plugin_manager->reveal());
+    $this->setExpectedException('\Drupal\migrate\MigrateSkipProcessException'); // ALGO LAST
     $migration->transform(0, $this->migrateExecutable, $this->row, 'foo');
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/process/SkipOnEmptyTest.php b/core/modules/migrate/tests/src/Unit/process/SkipOnEmptyTest.php
index bf40dac..bf98020 100644
--- a/core/modules/migrate/tests/src/Unit/process/SkipOnEmptyTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/SkipOnEmptyTest.php
@@ -13,10 +13,10 @@ class SkipOnEmptyTest extends MigrateProcessTestCase {
 
   /**
    * @covers ::process
-   * @expectedException \Drupal\migrate\MigrateSkipProcessException
    */
   public function testProcessSkipsOnEmpty() {
     $configuration['method'] = 'process';
+    $this->setExpectedException('\Drupal\migrate\MigrateSkipProcessException'); // ALGO LAST
     (new SkipOnEmpty($configuration, 'skip_on_empty', []))
       ->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
   }
@@ -33,10 +33,10 @@ class SkipOnEmptyTest extends MigrateProcessTestCase {
 
   /**
    * @covers ::row
-   * @expectedException \Drupal\migrate\MigrateSkipRowException
    */
   public function testRowSkipsOnEmpty() {
     $configuration['method'] = 'row';
+    $this->setExpectedException('\Drupal\migrate\MigrateSkipRowException'); // ALGO LAST
     (new SkipOnEmpty($configuration, 'skip_on_empty', []))
       ->transform('', $this->migrateExecutable, $this->row, 'destinationproperty');
   }
diff --git a/core/modules/migrate/tests/src/Unit/process/StaticMapTest.php b/core/modules/migrate/tests/src/Unit/process/StaticMapTest.php
index 59db2e5..2525a79 100644
--- a/core/modules/migrate/tests/src/Unit/process/StaticMapTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/StaticMapTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\migrate\Unit\process;
 
 use Drupal\migrate\Plugin\migrate\process\StaticMap;
+use Drupal\migrate\MigrateException;
 
 /**
  * Tests the static map process plugin.
@@ -38,19 +39,17 @@ class StaticMapTest extends MigrateProcessTestCase {
 
   /**
    * Tests when the source is empty.
-   *
-   * @expectedException \Drupal\migrate\MigrateException
    */
   public function testMapwithEmptySource() {
+    $this->setExpectedException(MigrationException::class); // ALGO ONE
     $this->plugin->transform(array(), $this->migrateExecutable, $this->row, 'destinationproperty');
   }
 
   /**
    * Tests when the source is invalid.
-   *
-   * @expectedException \Drupal\migrate\MigrateSkipRowException
    */
   public function testMapwithInvalidSource() {
+    $this->setExpectedException('\Drupal\migrate\MigrateSkipRowException'); // ALGO ONE
     $this->plugin->transform(array('bar'), $this->migrateExecutable, $this->row, 'destinationproperty');
   }
 
@@ -78,15 +77,13 @@ class StaticMapTest extends MigrateProcessTestCase {
 
   /**
    * Tests when the source is invalid and bypass is enabled.
-   *
-   * @expectedException \Drupal\migrate\MigrateException
-   * @expectedExceptionMessage Setting both default_value and bypass is invalid.
    */
   public function testMapWithInvalidSourceAndBypass() {
     $configuration['map']['foo']['bar'] = 'baz';
     $configuration['default_value'] = 'test';
     $configuration['bypass'] = TRUE;
     $this->plugin = new StaticMap($configuration, 'map', array());
+    $this->setExpectedException(MigrateException::class, 'Setting both default_value and bypass is invalid.'); // ALGO LAST
     $this->plugin->transform(array('bar'), $this->migrateExecutable, $this->row, 'destinationproperty');
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/process/SubstrTest.php b/core/modules/migrate/tests/src/Unit/process/SubstrTest.php
index fb84509..f30b9cc 100644
--- a/core/modules/migrate/tests/src/Unit/process/SubstrTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/SubstrTest.php
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\migrate\Unit\process;
 
 use Drupal\migrate\Plugin\migrate\process\Substr;
+use Drupal\migrate\MigrateException;
 
 /**
  * Tests the substr plugin.
@@ -55,37 +56,31 @@ class SubstrTest extends MigrateProcessTestCase {
 
   /**
    * Tests invalid input type.
-   *
-   * @expectedException \Drupal\migrate\MigrateException
-   * @expectedExceptionMessage The input value must be a string.
    */
   public function testSubstrFail() {
     $configuration = [];
     $this->plugin = new Substr($configuration, 'map', []);
+    $this->setExpectedException(MigrateException::class, 'The input value must be a string.'); // ALGO LAST
     $this->plugin->transform(['Captain Janeway'], $this->migrateExecutable, $this->row, 'destinationproperty');
   }
 
   /**
    * Tests that the start parameter is an integer.
-   *
-   * @expectedException \Drupal\migrate\MigrateException
-   * @expectedExceptionMessage The start position configuration value should be an integer. Omit this key to capture from the beginning of the string.
    */
   public function testStartIsString() {
     $configuration['start'] = '2';
     $this->plugin = new Substr($configuration, 'map', []);
+    $this->setExpectedException(MigrateException::class, 'The start position configuration value should be an integer. Omit this key to capture from the beginning of the string.'); // ALGO LAST
     $this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
   }
 
   /**
    * Tests that the length parameter is an integer.
-   *
-   * @expectedException \Drupal\migrate\MigrateException
-   * @expectedExceptionMessage The character length configuration value should be an integer. Omit this key to capture from the start position to the end of the string.
    */
   public function testLengthIsString() {
     $configuration['length'] = '1';
     $this->plugin = new Substr($configuration, 'map', []);
+    $this->setExpectedException(MigrateException::class, 'The character length configuration value should be an integer. Omit this key to capture from the start position to the end of the string.'); // ALGO LAST
     $this->plugin->transform(['foo'], $this->migrateExecutable, $this->row, 'destinationproperty');
   }
 
diff --git a/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php b/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php
index 7021070..c025d8d 100644
--- a/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php
+++ b/core/modules/serialization/tests/src/Unit/Normalizer/EntityNormalizerTest.php
@@ -82,10 +82,9 @@ class EntityNormalizerTest extends UnitTestCase {
    * Tests the denormalize() method with no entity type provided in context.
    *
    * @covers ::denormalize
-   *
-   * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
    */
   public function testDenormalizeWithNoEntityType() {
+    $this->setExpectedException('\Symfony\Component\Serializer\Exception\UnexpectedValueException'); // ALGO COVER (method)
     $this->entityNormalizer->denormalize(array(), 'Drupal\Core\Entity\ContentEntityBase');
   }
 
@@ -178,8 +177,6 @@ class EntityNormalizerTest extends UnitTestCase {
   /**
    * Tests the denormalize method with a bundle property.
    *
-   * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException
-   *
    * @covers ::denormalize
    */
   public function testDenormalizeWithInvalidBundle() {
@@ -243,6 +240,7 @@ class EntityNormalizerTest extends UnitTestCase {
       ->will($this->returnValue($entity_type_storage));
 
 
+    $this->setExpectedException('\Symfony\Component\Serializer\Exception\UnexpectedValueException'); // ALGO COVER (method)
     $this->entityNormalizer->denormalize($test_data, 'Drupal\Core\Entity\ContentEntityBase', NULL, ['entity_type' => 'test']);
   }
 
diff --git a/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php b/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php
index df98377..358188b 100644
--- a/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php
+++ b/core/modules/simpletest/tests/src/Unit/TestInfoParsingTest.php
@@ -235,8 +235,6 @@ class TestInfoParsingTest extends UnitTestCase {
 
   /**
    * @covers ::getTestInfo
-   * @expectedException \Drupal\simpletest\Exception\MissingGroupException
-   * @expectedExceptionMessage Missing @group annotation in Drupal\KernelTests\field\BulkDeleteTest
    */
   public function testTestInfoParserMissingGroup() {
     $classname = 'Drupal\KernelTests\field\BulkDeleteTest';
@@ -245,6 +243,7 @@ class TestInfoParsingTest extends UnitTestCase {
  * Bulk delete storages and fields, and clean up afterwards.
  */
 EOT;
+    $this->setExpectedException('\Drupal\simpletest\Exception\MissingGroupException', 'Missing @group annotation in Drupal\KernelTests\field\BulkDeleteTest'); // ALGO COVER (method)
     TestDiscovery::getTestInfo($classname, $doc_comment);
   }
 
diff --git a/core/modules/system/tests/modules/accept_header_routing_test/tests/Unit/AcceptHeaderMatcherTest.php b/core/modules/system/tests/modules/accept_header_routing_test/tests/Unit/AcceptHeaderMatcherTest.php
index 16bb08f..3c835d7 100644
--- a/core/modules/system/tests/modules/accept_header_routing_test/tests/Unit/AcceptHeaderMatcherTest.php
+++ b/core/modules/system/tests/modules/accept_header_routing_test/tests/Unit/AcceptHeaderMatcherTest.php
@@ -86,9 +86,6 @@ class AcceptHeaderMatcherTest extends UnitTestCase {
 
   /**
    * Confirms that the AcceptHeaderMatcher throws an exception for no-route.
-   *
-   * @expectedException \Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException
-   * @expectedExceptionMessage No route found for the specified formats application/json text/xml.
    */
   public function testNoRouteFound() {
     // Remove the sample routes that would match any method.
@@ -103,6 +100,7 @@ class AcceptHeaderMatcherTest extends UnitTestCase {
     $request->setRequestFormat('json');
     $this->matcher->filter($routes, $request);
     $this->matcher->filter($routes, $request);
+    $this->setExpectedException('\Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException', 'No route found for the specified formats application/json text/xml.'); // ALGO LAST
     $this->fail('No exception was thrown.');
   }
 
diff --git a/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php b/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php
index 1aa2f66..81bde70 100644
--- a/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php
+++ b/core/modules/system/tests/src/Kernel/Scripts/DbCommandBaseTest.php
@@ -42,8 +42,6 @@ class DbCommandBaseTest extends KernelTestBase {
 
   /**
    * Invalid database names will throw a useful exception.
-   *
-   * @expectedException \Drupal\Core\Database\ConnectionNotDefinedException
    */
   public function testSpecifyDatabaseDoesNotExist() {
     $command = new DbCommandBaseTester();
@@ -51,6 +49,7 @@ class DbCommandBaseTest extends KernelTestBase {
     $command_tester->execute([
       '--database' => 'dne'
     ]);
+    $this->setExpectedException('\Drupal\Core\Database\ConnectionNotDefinedException'); // ALGO LAST
     $command->getDatabaseConnection($command_tester->getInput());
   }
 
diff --git a/core/modules/user/tests/src/Unit/PrivateTempStoreTest.php b/core/modules/user/tests/src/Unit/PrivateTempStoreTest.php
index 515c862..2249bb3 100644
--- a/core/modules/user/tests/src/Unit/PrivateTempStoreTest.php
+++ b/core/modules/user/tests/src/Unit/PrivateTempStoreTest.php
@@ -121,7 +121,6 @@ class PrivateTempStoreTest extends UnitTestCase {
    * Tests the set() method with no lock available.
    *
    * @covers ::set
-   * @expectedException \Drupal\user\TempStoreException
    */
   public function testSetWithNoLockAvailable() {
     $this->lock->expects($this->at(0))
@@ -139,6 +138,7 @@ class PrivateTempStoreTest extends UnitTestCase {
     $this->keyValue->expects($this->once())
       ->method('getCollectionName');
 
+    $this->setExpectedException('\Drupal\user\TempStoreException'); // ALGO COVER (method)
     $this->tempStore->set('test', 'value');
   }
 
@@ -220,7 +220,6 @@ class PrivateTempStoreTest extends UnitTestCase {
    * Tests the delete() method with no lock available.
    *
    * @covers ::delete
-   * @expectedException \Drupal\user\TempStoreException
    */
   public function testDeleteWithNoLockAvailable() {
     $this->keyValue->expects($this->once())
@@ -242,6 +241,7 @@ class PrivateTempStoreTest extends UnitTestCase {
     $this->keyValue->expects($this->once())
       ->method('getCollectionName');
 
+    $this->setExpectedException('\Drupal\user\TempStoreException'); // ALGO COVER (method)
     $this->tempStore->delete('test');
   }
 
diff --git a/core/modules/user/tests/src/Unit/SharedTempStoreTest.php b/core/modules/user/tests/src/Unit/SharedTempStoreTest.php
index 15a4ec6..33637d1 100644
--- a/core/modules/user/tests/src/Unit/SharedTempStoreTest.php
+++ b/core/modules/user/tests/src/Unit/SharedTempStoreTest.php
@@ -132,7 +132,6 @@ class SharedTempStoreTest extends UnitTestCase {
    * Tests the set() method with no lock available.
    *
    * @covers ::set
-   * @expectedException \Drupal\user\TempStoreException
    */
   public function testSetWithNoLockAvailable() {
     $this->lock->expects($this->at(0))
@@ -150,6 +149,7 @@ class SharedTempStoreTest extends UnitTestCase {
     $this->keyValue->expects($this->once())
       ->method('getCollectionName');
 
+    $this->setExpectedException('\Drupal\user\TempStoreException'); // ALGO COVER (method)
     $this->tempStore->set('test', 'value');
   }
 
@@ -296,7 +296,6 @@ class SharedTempStoreTest extends UnitTestCase {
    * Tests the delete() method with no lock available.
    *
    * @covers ::delete
-   * @expectedException \Drupal\user\TempStoreException
    */
   public function testDeleteWithNoLockAvailable() {
     $this->lock->expects($this->at(0))
@@ -314,6 +313,7 @@ class SharedTempStoreTest extends UnitTestCase {
     $this->keyValue->expects($this->once())
       ->method('getCollectionName');
 
+    $this->setExpectedException('\Drupal\user\TempStoreException'); // ALGO COVER (method)
     $this->tempStore->delete('test');
   }
 
diff --git a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
index d6b2a1e..1e1e7af 100644
--- a/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
+++ b/core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php
@@ -113,18 +113,15 @@ class ViewAjaxControllerTest extends UnitTestCase {
 
   /**
    * Tests missing view_name and view_display_id
-   *
-   * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
    */
   public function testMissingViewName() {
     $request = new Request();
+    $this->setExpectedException('\Symfony\Component\HttpKernel\Exception\NotFoundHttpException'); // ALGO LAST
     $this->viewAjaxController->ajaxView($request);
   }
 
   /**
    * Tests with view_name and view_display_id but not existing view.
-   *
-   * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
    */
   public function testMissingView() {
     $request = new Request();
@@ -136,13 +133,12 @@ class ViewAjaxControllerTest extends UnitTestCase {
       ->with('test_view')
       ->will($this->returnValue(FALSE));
 
+    $this->setExpectedException('\Symfony\Component\HttpKernel\Exception\NotFoundHttpException'); // ALGO LAST
     $this->viewAjaxController->ajaxView($request);
   }
 
   /**
    * Tests a view without having access to it.
-   *
-   * @expectedException \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
    */
   public function testAccessDeniedView() {
     $request = new Request();
@@ -170,6 +166,7 @@ class ViewAjaxControllerTest extends UnitTestCase {
       ->with($view)
       ->will($this->returnValue($executable));
 
+    $this->setExpectedException('\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException'); // ALGO LAST
     $this->viewAjaxController->ajaxView($request);
   }
 
diff --git a/core/modules/views/tests/src/Unit/Plugin/display/PageTest.php b/core/modules/views/tests/src/Unit/Plugin/display/PageTest.php
index 55ead47..6955e99 100644
--- a/core/modules/views/tests/src/Unit/Plugin/display/PageTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/display/PageTest.php
@@ -30,9 +30,9 @@ class PageTest extends UnitTestCase {
 
   /**
    * @covers ::buildBasicRenderable
-   * @expectedException \BadFunctionCallException
    */
   public function testBuildBasicRenderableWithMissingRoute() {
+    $this->setExpectedException('\BadFunctionCallException'); // ALGO COVER (method)
     Page::buildBasicRenderable('test_view', 'page_1', []);
   }
 
diff --git a/core/modules/views/tests/src/Unit/ViewExecutableTest.php b/core/modules/views/tests/src/Unit/ViewExecutableTest.php
index fe64ec2..b1fee64 100644
--- a/core/modules/views/tests/src/Unit/ViewExecutableTest.php
+++ b/core/modules/views/tests/src/Unit/ViewExecutableTest.php
@@ -182,7 +182,6 @@ class ViewExecutableTest extends UnitTestCase {
   }
 
   /**
-   * @expectedException \InvalidArgumentException
    *
    * @covers ::getUrl
    */
@@ -193,6 +192,7 @@ class ViewExecutableTest extends UnitTestCase {
       ->willReturn($this->displayHandler);
     $this->executable->display_handler = $this->displayHandler;
 
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (method)
     $this->executable->getUrl();
   }
 
diff --git a/core/tests/Drupal/KernelTests/Component/Utility/SafeMarkupKernelTest.php b/core/tests/Drupal/KernelTests/Component/Utility/SafeMarkupKernelTest.php
index cd42ad1..ad8a93e 100644
--- a/core/tests/Drupal/KernelTests/Component/Utility/SafeMarkupKernelTest.php
+++ b/core/tests/Drupal/KernelTests/Component/Utility/SafeMarkupKernelTest.php
@@ -107,10 +107,10 @@ class SafeMarkupKernelTest extends KernelTestBase {
 
   /**
    * @dataProvider providerTestSafeMarkupUriWithException
-   * @expectedException \InvalidArgumentException
    */
   public function testSafeMarkupUriWithExceptionUri($string, $uri) {
     // Should throw an \InvalidArgumentException, due to Uri::toString().
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO MANUAL MAP
     $args = self::getSafeMarkupUriArgs($uri);
 
     SafeMarkup::format($string, $args);
diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ThemeRenderAndAutoescapeTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ThemeRenderAndAutoescapeTest.php
index 98423ca..c335820 100644
--- a/core/tests/Drupal/KernelTests/Core/Theme/ThemeRenderAndAutoescapeTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Theme/ThemeRenderAndAutoescapeTest.php
@@ -82,10 +82,9 @@ class ThemeRenderAndAutoescapeTest extends KernelTestBase {
 
   /**
    * Ensures invalid content is handled correctly.
-   *
-   * @expectedException \Exception
    */
   public function testThemeEscapeAndRenderNotPrintable() {
+    $this->setExpectedException('\Exception'); // ALGO ONE
     theme_render_and_autoescape(new NonPrintable());
   }
 
diff --git a/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php
index b8be130..29276bc 100644
--- a/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php
+++ b/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php
@@ -100,9 +100,9 @@ class DateTimePlusTest extends UnitTestCase {
    *   Timezone argument for DateTimePlus.
    *
    * @dataProvider providerTestInvalidDateArrays
-   * @expectedException \Exception
    */
   public function testInvalidDateArrays($input, $timezone) {
+    $this->setExpectedException('\Exception'); // ALGO ONE
     $this->assertInstanceOf(
       '\Drupal\Component\DateTimePlus',
       DateTimePlus::createFromArray($input, $timezone)
@@ -236,9 +236,9 @@ class DateTimePlusTest extends UnitTestCase {
    *   Message to print if no errors are thrown by the invalid dates.
    *
    * @dataProvider providerTestInvalidDates
-   * @expectedException \Exception
    */
   public function testInvalidDates($input, $timezone, $format, $message) {
+    $this->setExpectedException('\Exception'); // ALGO ONE
     DateTimePlus::createFromFormat($format, $input, $timezone);
   }
 
diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
index 3c89804..82e6078 100644
--- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
+++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php
@@ -59,12 +59,11 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    * Tests that passing a non-supported format throws an InvalidArgumentException.
    *
    * @covers ::__construct
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
    */
   public function testConstruct() {
     $container_definition = $this->getMockContainerDefinition();
     $container_definition['machine_format'] = !$this->machineFormat;
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException'); // ALGO COVER (body)
     $container = new $this->containerClass($container_definition);
   }
 
@@ -85,10 +84,9 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    * @covers ::getParameter
    * @covers ::getParameterAlternatives
    * @covers ::getAlternatives
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException
    */
   public function testGetParameterIfNotFound() {
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException'); // ALGO COVER (method)
     $this->container->getParameter('parameter_that_does_not_exist');
   }
 
@@ -96,10 +94,9 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    * Tests that Container::getParameter() works properly for NULL parameters.
    *
    * @covers ::getParameter
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException
    */
   public function testGetParameterIfNotFoundBecauseNull() {
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException'); // ALGO COVER (method)
     $this->container->getParameter(NULL);
   }
 
@@ -130,11 +127,10 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    * Tests that Container::setParameter() in a frozen case works properly.
    *
    * @covers ::setParameter
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
    */
   public function testSetParameterWithFrozenContainer() {
     $this->container = new $this->containerClass($this->containerDefinition);
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\LogicException'); // ALGO COVER (method)
     $this->container->setParameter('some_config', 'new_value');
   }
 
@@ -235,11 +231,11 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
 
   /**
    * Tests that Container::get() for circular dependencies works properly.
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
    * @covers ::get
    * @covers ::createService
    */
   public function testGetForCircularServices() {
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException'); // ALGO COVER (method)
     $this->container->get('circular_dependency');
   }
 
@@ -250,10 +246,9 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    * @covers ::createService
    * @covers ::getAlternatives
    * @covers ::getServiceAlternatives
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
    */
   public function testGetForNonExistantService() {
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException'); // ALGO COVER (method)
     $this->container->get('service_not_exists');
   }
 
@@ -295,8 +290,6 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    * @covers ::get
    * @covers ::createService
    * @covers ::resolveServicesAndParameters
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
    */
   public function testGetForParameterDependencyWithExceptionOnSecondCall() {
     $service = $this->container->get('service_parameter_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE);
@@ -304,6 +297,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
 
     // Reset the service.
     $this->container->set('service_parameter_not_exists', NULL);
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException'); // ALGO COVER (method)
     $this->container->get('service_parameter_not_exists');
   }
 
@@ -313,10 +307,9 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    * @covers ::get
    * @covers ::createService
    * @covers ::resolveServicesAndParameters
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
    */
   public function testGetForNonExistantParameterDependencyWithException() {
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException'); // ALGO COVER (method)
     $this->container->get('service_parameter_not_exists');
   }
 
@@ -339,10 +332,9 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    * @covers ::createService
    * @covers ::resolveServicesAndParameters
    * @covers ::getAlternatives
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
    */
   public function testGetForNonExistantServiceDependencyWithException() {
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException'); // ALGO COVER (method)
     $this->container->get('service_dependency_not_exists');
   }
 
@@ -360,10 +352,9 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    * Tests that Container::get() for NULL service works properly.
    * @covers ::get
    * @covers ::createService
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
    */
   public function testGetForNonExistantNULLService() {
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException'); // ALGO COVER (method)
     $this->container->get(NULL);
   }
 
@@ -386,11 +377,10 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    * @covers ::get
    * @covers ::createService
    * @covers ::getAlternatives
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
    */
   public function testGetForNonExistantServiceWithExceptionOnSecondCall() {
     $this->assertNull($this->container->get('service_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE), 'Not found service does nto throw exception.');
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException'); // ALGO COVER (method)
     $this->container->get('service_not_exists');
   }
 
@@ -424,10 +414,9 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    *
    * @covers ::get
    * @covers ::createService
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
    */
   public function testGetForSyntheticServiceWithException() {
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\RuntimeException'); // ALGO COVER (method)
     $this->container->get('synthetic');
   }
 
@@ -464,10 +453,9 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    *
    * @covers ::get
    * @covers ::createService
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
    */
   public function testGetForWrongFactory() {
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\RuntimeException'); // ALGO COVER (method)
     $this->container->get('wrong_factory');
   }
 
@@ -503,10 +491,9 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    *
    * @covers ::get
    * @covers ::createService
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
    */
   public function testGetForConfiguratorWithException() {
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException'); // ALGO COVER (method)
     $this->container->get('configurable_service_exception');
   }
 
@@ -602,10 +589,9 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    * @covers ::get
    * @covers ::createService
    * @covers ::resolveServicesAndParameters
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
    */
   public function testResolveServicesAndParametersForInvalidArgument() {
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException'); // ALGO COVER (method)
     $this->container->get('invalid_argument_service');
   }
 
@@ -615,12 +601,11 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    * @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
     // test failure.
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException'); // ALGO MANUAL MAP
     if (!$this->machineFormat) {
       throw new InvalidArgumentException('Simulating the test failure.');
     }
@@ -671,8 +656,6 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
    * @covers ::hasScope
    * @covers ::isScopeActive
    *
-   * @expectedException \BadMethodCallException
-   *
    * @dataProvider scopeExceptionTestProvider
    */
   public function testScopeFunctionsWithException($method, $argument) {
@@ -681,6 +664,7 @@ class ContainerTest extends \PHPUnit_Framework_TestCase {
       $method,
     );
 
+    $this->setExpectedException('\BadMethodCallException'); // ALGO LAST
     $callable($argument);
   }
 
diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php
index 49b6556..3ee4ba2 100644
--- a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php
+++ b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php
@@ -481,8 +481,6 @@ namespace Drupal\Tests\Component\DependencyInjection\Dumper {
      * Tests that the correct InvalidArgumentException is thrown for getScope().
      *
      * @covers ::getServiceDefinition
-     *
-     * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
      */
     public function testGetServiceDefinitionWithInvalidScope() {
       $bar_definition = new Definition('\stdClass');
@@ -490,6 +488,7 @@ namespace Drupal\Tests\Component\DependencyInjection\Dumper {
       $services['bar'] = $bar_definition;
 
       $this->containerBuilder->getDefinitions()->willReturn($services);
+      $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException'); // ALGO LAST
       $this->dumper->getArray();
     }
 
@@ -554,8 +553,6 @@ namespace Drupal\Tests\Component\DependencyInjection\Dumper {
      * getDecoratedService().
      *
      * @covers ::getServiceDefinition
-     *
-     * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
      */
     public function testGetServiceDefinitionForDecoratedService() {
       $bar_definition = new Definition('\stdClass');
@@ -563,6 +560,7 @@ namespace Drupal\Tests\Component\DependencyInjection\Dumper {
       $services['bar'] = $bar_definition;
 
       $this->containerBuilder->getDefinitions()->willReturn($services);
+      $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException'); // ALGO LAST
       $this->dumper->getArray();
     }
 
@@ -570,8 +568,6 @@ namespace Drupal\Tests\Component\DependencyInjection\Dumper {
      * Tests that the correct RuntimeException is thrown for expressions.
      *
      * @covers ::dumpValue
-     *
-     * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
      */
     public function testGetServiceDefinitionForExpression() {
       $expression = new Expression();
@@ -581,6 +577,7 @@ namespace Drupal\Tests\Component\DependencyInjection\Dumper {
       $services['bar'] = $bar_definition;
 
       $this->containerBuilder->getDefinitions()->willReturn($services);
+      $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\RuntimeException'); // ALGO LAST
       $this->dumper->getArray();
     }
 
@@ -588,8 +585,6 @@ namespace Drupal\Tests\Component\DependencyInjection\Dumper {
      * Tests that the correct RuntimeException is thrown for dumping an object.
      *
      * @covers ::dumpValue
-     *
-     * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
      */
     public function testGetServiceDefinitionForObject() {
       $service = new \stdClass();
@@ -599,6 +594,7 @@ namespace Drupal\Tests\Component\DependencyInjection\Dumper {
       $services['bar'] = $bar_definition;
 
       $this->containerBuilder->getDefinitions()->willReturn($services);
+      $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\RuntimeException'); // ALGO LAST
       $this->dumper->getArray();
     }
 
@@ -606,8 +602,6 @@ namespace Drupal\Tests\Component\DependencyInjection\Dumper {
      * Tests that the correct RuntimeException is thrown for dumping a resource.
      *
      * @covers ::dumpValue
-     *
-     * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
      */
     public function testGetServiceDefinitionForResource() {
       $resource = fopen('php://memory', 'r');
@@ -617,6 +611,7 @@ namespace Drupal\Tests\Component\DependencyInjection\Dumper {
       $services['bar'] = $bar_definition;
 
       $this->containerBuilder->getDefinitions()->willReturn($services);
+      $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\RuntimeException'); // ALGO LAST
       $this->dumper->getArray();
     }
 
diff --git a/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php b/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php
index b4d8de9..1089d35 100644
--- a/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php
+++ b/core/tests/Drupal/Tests/Component/FileCache/FileCacheFactoryTest.php
@@ -55,12 +55,10 @@ class FileCacheFactoryTest extends UnitTestCase {
 
   /**
    * @covers ::get
-   *
-   * @expectedException \InvalidArgumentException
-   * @expectedExceptionMessage Required prefix configuration is missing
    */
   public function testGetNoPrefix() {
     FileCacheFactory::setPrefix(NULL);
+    $this->setExpectedException('\InvalidArgumentException', 'Required prefix configuration is missing'); // ALGO COVER (method)
     FileCacheFactory::get('test_foo_settings', []);
   }
 
diff --git a/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php b/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php
index 1fc805b..4f68cda 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/DefaultFactoryTest.php
@@ -47,11 +47,9 @@ class DefaultFactoryTest extends UnitTestCase {
    * Tests getPluginClass() with a missing class definition.
    *
    * @covers ::getPluginClass
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginException
-   * @expectedExceptionMessage The plugin (cherry) did not specify an instance class.
    */
   public function testGetPluginClassWithMissingClassWithArrayPluginDefinition() {
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginException', 'The plugin (cherry) did not specify an instance class.'); // ALGO COVER (method)
     DefaultFactory::getPluginClass('cherry', []);
   }
 
@@ -59,12 +57,10 @@ class DefaultFactoryTest extends UnitTestCase {
    * Tests getPluginClass() with a missing class definition.
    *
    * @covers ::getPluginClass
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginException
-   * @expectedExceptionMessage The plugin (cherry) did not specify an instance class.
    */
   public function testGetPluginClassWithMissingClassWithObjectPluginDefinition() {
     $plugin_definition = $this->getMock(PluginDefinitionInterface::class);
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginException', 'The plugin (cherry) did not specify an instance class.'); // ALGO COVER (method)
     DefaultFactory::getPluginClass('cherry', $plugin_definition);
   }
 
@@ -72,11 +68,9 @@ class DefaultFactoryTest extends UnitTestCase {
    * Tests getPluginClass() with a not existing class definition.
    *
    * @covers ::getPluginClass
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginException
-   * @expectedExceptionMessage Plugin (kiwifruit) instance class "\Drupal\plugin_test\Plugin\plugin_test\fruit\Kiwifruit" does not exist.
    */
   public function testGetPluginClassWithNotExistingClassWithArrayPluginDefinition() {
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginException', 'Plugin (kiwifruit) instance class "\Drupal\plugin_test\Plugin\plugin_test\fruit\Kiwifruit" does not exist.'); // ALGO COVER (method)
     DefaultFactory::getPluginClass('kiwifruit', ['class' => '\Drupal\plugin_test\Plugin\plugin_test\fruit\Kiwifruit']);
   }
 
@@ -84,8 +78,6 @@ class DefaultFactoryTest extends UnitTestCase {
    * Tests getPluginClass() with a not existing class definition.
    *
    * @covers ::getPluginClass
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginException
    */
   public function testGetPluginClassWithNotExistingClassWithObjectPluginDefinition() {
     $plugin_class = '\Drupal\plugin_test\Plugin\plugin_test\fruit\Kiwifruit';
@@ -93,6 +85,7 @@ class DefaultFactoryTest extends UnitTestCase {
     $plugin_definition->expects($this->atLeastOnce())
       ->method('getClass')
       ->willReturn($plugin_class);
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginException'); // ALGO COVER (method)
     DefaultFactory::getPluginClass('kiwifruit', $plugin_definition);
   }
 
@@ -128,12 +121,10 @@ class DefaultFactoryTest extends UnitTestCase {
    * Tests getPluginClass() with a required interface but no implementation.
    *
    * @covers ::getPluginClass
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginException
-   * @expectedExceptionMessage Plugin "cherry" (Drupal\plugin_test\Plugin\plugin_test\fruit\Kale) must implement interface Drupal\plugin_test\Plugin\plugin_test\fruit\FruitInterface.
    */
   public function testGetPluginClassWithInterfaceAndInvalidClassWithArrayPluginDefinition() {
     $plugin_class = Kale::class;
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginException', 'Plugin "cherry" (Drupal\plugin_test\Plugin\plugin_test\fruit\Kale) must implement interface Drupal\plugin_test\Plugin\plugin_test\fruit\FruitInterface.'); // ALGO COVER (method)
     DefaultFactory::getPluginClass('cherry', ['class' => $plugin_class, 'provider' => 'core'], FruitInterface::class);
   }
 
@@ -141,8 +132,6 @@ class DefaultFactoryTest extends UnitTestCase {
    * Tests getPluginClass() with a required interface but no implementation.
    *
    * @covers ::getPluginClass
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginException
    */
   public function testGetPluginClassWithInterfaceAndInvalidClassWithObjectPluginDefinition() {
     $plugin_class = Kale::class;
@@ -150,6 +139,7 @@ class DefaultFactoryTest extends UnitTestCase {
     $plugin_definition->expects($this->atLeastOnce())
       ->method('getClass')
       ->willReturn($plugin_class);
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginException'); // ALGO COVER (method)
     DefaultFactory::getPluginClass('cherry', $plugin_definition, FruitInterface::class);
   }
 
diff --git a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php
index 9f747f9..632938b 100644
--- a/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php
+++ b/core/tests/Drupal/Tests/Component/Plugin/Discovery/DiscoveryTraitTest.php
@@ -58,7 +58,6 @@ class DiscoveryTraitTest extends UnitTestCase {
 
   /**
    * @covers ::doGetDefinition
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginNotFoundException
    * @dataProvider providerDoGetDefinitionException
    * @uses \Drupal\Component\Plugin\Exception\PluginNotFoundException
    */
@@ -67,6 +66,7 @@ class DiscoveryTraitTest extends UnitTestCase {
     $trait = $this->getMockForTrait('Drupal\Component\Plugin\Discovery\DiscoveryTrait');
     // Un-protect the method using reflection.
     $method_ref = new \ReflectionMethod($trait, 'doGetDefinition');
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginNotFoundException'); // ALGO ASSERT
     $method_ref->setAccessible(TRUE);
     // Call doGetDefinition, with $exception_on_invalid always TRUE.
     $this->assertSame(
@@ -96,7 +96,6 @@ class DiscoveryTraitTest extends UnitTestCase {
 
   /**
    * @covers ::getDefinition
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginNotFoundException
    * @dataProvider providerDoGetDefinitionException
    * @uses \Drupal\Component\Plugin\Exception\PluginNotFoundException
    */
@@ -109,6 +108,7 @@ class DiscoveryTraitTest extends UnitTestCase {
       ->method('getDefinitions')
       ->willReturn($definitions);
     // Call getDefinition(), with $exception_on_invalid always TRUE.
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginNotFoundException'); // ALGO COVER (body)
     $this->assertSame(
       $expected,
       $trait->getDefinition($plugin_id, TRUE)
diff --git a/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php b/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php
index ef0d7fb..f5824ee 100644
--- a/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php
+++ b/core/tests/Drupal/Tests/Component/Serialization/YamlPeclTest.php
@@ -74,9 +74,9 @@ foo:
    * Tests that invalid YAML throws an exception.
    *
    * @covers ::errorHandler
-   * @expectedException \Drupal\Component\Serialization\Exception\InvalidDataTypeException
    */
   public function testError() {
+    $this->setExpectedException('\Drupal\Component\Serialization\Exception\InvalidDataTypeException'); // ALGO ONE
     YamlPecl::decode('foo: [ads');
   }
 
diff --git a/core/tests/Drupal/Tests/Component/Serialization/YamlSymfonyTest.php b/core/tests/Drupal/Tests/Component/Serialization/YamlSymfonyTest.php
index 3101efe..3f99ca7 100644
--- a/core/tests/Drupal/Tests/Component/Serialization/YamlSymfonyTest.php
+++ b/core/tests/Drupal/Tests/Component/Serialization/YamlSymfonyTest.php
@@ -56,9 +56,9 @@ class YamlSymfonyTest extends YamlTestBase {
    * Tests that invalid YAML throws an exception.
    *
    * @covers ::decode
-   * @expectedException \Drupal\Component\Serialization\Exception\InvalidDataTypeException
    */
   public function testError() {
+    $this->setExpectedException('\Drupal\Component\Serialization\Exception\InvalidDataTypeException'); // ALGO COVER (method)
     YamlSymfony::decode('foo: [ads');
   }
 
diff --git a/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php b/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php
index 878bbfd..ca67d28 100644
--- a/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php
@@ -121,9 +121,6 @@ class ArgumentsResolverTest extends UnitTestCase {
    * 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');
@@ -131,6 +128,7 @@ class ArgumentsResolverTest extends UnitTestCase {
     $resolver = new ArgumentsResolver([], [], $wildcards);
 
     $callable = function($route) {};
+    $this->setExpectedException('\RuntimeException', 'requires a value for the "$route" argument.'); // ALGO ASSERT
     $arguments = $resolver->getArguments($callable);
     $this->assertNull($arguments);
   }
@@ -152,9 +150,6 @@ class ArgumentsResolverTest extends UnitTestCase {
 
   /**
    * Tests handleUnresolvedArgument() for a scalar argument.
-   *
-   * @expectedException \RuntimeException
-   * @expectedExceptionMessage requires a value for the "$foo" argument.
    */
   public function testHandleNotUpcastedArgument() {
     $objects = ['foo' => 'bar'];
@@ -162,6 +157,7 @@ class ArgumentsResolverTest extends UnitTestCase {
     $resolver = new ArgumentsResolver($scalars, $objects, []);
 
     $callable = function(\stdClass $foo) {};
+    $this->setExpectedException('\RuntimeException', 'requires a value for the "$foo" argument.'); // ALGO ASSERT
     $arguments = $resolver->getArguments($callable);
     $this->assertNull($arguments);
   }
@@ -169,13 +165,11 @@ class ArgumentsResolverTest extends UnitTestCase {
   /**
    * Tests handleUnresolvedArgument() for missing arguments.
    *
-   * @expectedException \RuntimeException
-   * @expectedExceptionMessage requires a value for the "$foo" argument.
-   *
    * @dataProvider providerTestHandleUnresolvedArgument
    */
   public function testHandleUnresolvedArgument($callable) {
     $resolver = new ArgumentsResolver([], [], []);
+    $this->setExpectedException('\RuntimeException', 'requires a value for the "$foo" argument.'); // ALGO ASSERT
     $arguments = $resolver->getArguments($callable);
     $this->assertNull($arguments);
   }
diff --git a/core/tests/Drupal/Tests/Component/Utility/CryptTest.php b/core/tests/Drupal/Tests/Component/Utility/CryptTest.php
index 42d6015..c27eab1 100644
--- a/core/tests/Drupal/Tests/Component/Utility/CryptTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/CryptTest.php
@@ -69,7 +69,6 @@ class CryptTest extends UnitTestCase {
    * Tests the hmacBase64 method with invalid parameters.
    *
    * @dataProvider providerTestHmacBase64Invalid
-   * @expectedException InvalidArgumentException
    * @covers ::hmacBase64
    *
    * @param string $data
@@ -78,6 +77,7 @@ class CryptTest extends UnitTestCase {
    *   Key to use in hashing process.
    */
   public function testHmacBase64Invalid($data, $key) {
+    $this->setExpectedException('InvalidArgumentException'); // ALGO COVER (method)
     Crypt::hmacBase64($data, $key);
   }
 
diff --git a/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php b/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php
index 6a106c7..8f867fb 100644
--- a/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/HtmlTest.php
@@ -332,9 +332,9 @@ class HtmlTest extends UnitTestCase {
   /**
    * @covers ::transformRootRelativeUrlsToAbsolute
    * @dataProvider providerTestTransformRootRelativeUrlsToAbsoluteAssertion
-   * @expectedException \AssertionError
    */
   public function testTransformRootRelativeUrlsToAbsoluteAssertion($scheme_and_host) {
+    $this->setExpectedException('\AssertionError'); // ALGO COVER (method)
     Html::transformRootRelativeUrlsToAbsolute('', $scheme_and_host);
   }
 
diff --git a/core/tests/Drupal/Tests/Component/Utility/RandomTest.php b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php
index b677585..9b5a0c0 100644
--- a/core/tests/Drupal/Tests/Component/Utility/RandomTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/RandomTest.php
@@ -57,12 +57,12 @@ class RandomTest extends UnitTestCase {
    * 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'); // ALGO COVER (body)
     for ($i = 0; $i <= 100; $i++) {
       $str = $random->name(1, TRUE);
       $names[$str] = TRUE;
@@ -73,12 +73,12 @@ class RandomTest extends UnitTestCase {
    * 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'); // ALGO COVER (body)
     for ($i = 0; $i <= 100; $i++) {
       $str = $random->string(1, TRUE);
       $names[$str] = TRUE;
diff --git a/core/tests/Drupal/Tests/Component/Utility/RectangleTest.php b/core/tests/Drupal/Tests/Component/Utility/RectangleTest.php
index 0aa29a6..d95d78e 100644
--- a/core/tests/Drupal/Tests/Component/Utility/RectangleTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/RectangleTest.php
@@ -15,10 +15,9 @@ class RectangleTest extends UnitTestCase {
    * Tests wrong rectangle width.
    *
    * @covers ::rotate
-   *
-   * @expectedException \InvalidArgumentException
    */
   public function testWrongWidth() {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO ONE
     $rect = new Rectangle(-40, 20);
   }
 
@@ -26,10 +25,9 @@ class RectangleTest extends UnitTestCase {
    * Tests wrong rectangle height.
    *
    * @covers ::rotate
-   *
-   * @expectedException \InvalidArgumentException
    */
   public function testWrongHeight() {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO ONE
     $rect = new Rectangle(40, 0);
   }
 
diff --git a/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php
index 87ab75f..0c01dd4 100644
--- a/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php
+++ b/core/tests/Drupal/Tests/Component/Utility/UrlHelperTest.php
@@ -560,9 +560,9 @@ class UrlHelperTest extends UnitTestCase {
    *
    * @covers ::externalIsLocal
    * @dataProvider providerTestExternalIsLocalInvalid
-   * @expectedException \InvalidArgumentException
    */
   public function testExternalIsLocalInvalid($url, $base_url) {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (method)
     UrlHelper::externalIsLocal($url, $base_url);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
index eee5260..20ac63f 100644
--- a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
@@ -474,8 +474,6 @@ class AccessManagerTest extends UnitTestCase {
    * Tests that an access checker throws an exception for not allowed values.
    *
    * @dataProvider providerCheckException
-   *
-   * @expectedException \Drupal\Core\Access\AccessException
    */
   public function testCheckException($return_value) {
     $route_provider = $this->getMock('Drupal\Core\Routing\RouteProviderInterface');
@@ -515,6 +513,7 @@ class AccessManagerTest extends UnitTestCase {
     $this->checkProvider->setContainer($container);
     $this->checkProvider->addCheckService('test_incorrect_value', 'access');
 
+    $this->setExpectedException('\Drupal\Core\Access\AccessException'); // ALGO LAST
     $access_manager->checkNamedRoute('test_incorrect_value', array(), $this->account);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php b/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
index 6eabd37..64f5afe 100644
--- a/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Access/CsrfTokenGeneratorTest.php
@@ -171,11 +171,11 @@ class CsrfTokenGeneratorTest extends UnitTestCase {
    *
    * @covers ::validate
    * @dataProvider providerTestInvalidParameterTypes
-   * @expectedException InvalidArgumentException
    */
   public function testInvalidParameterTypes($token, $value = '') {
     $this->setupDefaultExpectations();
 
+    $this->setExpectedException('InvalidArgumentException'); // ALGO COVER (method)
     $this->generator->validate($token, $value);
   }
 
@@ -198,12 +198,12 @@ class CsrfTokenGeneratorTest extends UnitTestCase {
    * Tests the exception thrown when no 'hash_salt' is provided in settings.
    *
    * @covers ::get
-   * @expectedException \RuntimeException
    */
   public function testGetWithNoHashSalt() {
     // Update settings with no hash salt.
     new Settings(array());
     $generator = new CsrfTokenGenerator($this->privateKey, $this->sessionMetadata);
+    $this->setExpectedException('\RuntimeException'); // ALGO COVER (method)
     $generator->get();
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
index 121aebc..3f3a3cf 100644
--- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
@@ -143,8 +143,6 @@ class LibraryDiscoveryParserTest extends UnitTestCase {
   /**
    * Tests that an exception is thrown when a libraries file couldn't be parsed.
    *
-   * @expectedException \Drupal\Core\Asset\Exception\InvalidLibraryFileException
-   *
    * @covers ::buildByExtension
    */
   public function testInvalidLibrariesFile() {
@@ -157,15 +155,13 @@ class LibraryDiscoveryParserTest extends UnitTestCase {
     $path = substr($path, strlen($this->root) + 1);
     $this->libraryDiscoveryParser->setPaths('module', 'invalid_file', $path);
 
+    $this->setExpectedException('\Drupal\Core\Asset\Exception\InvalidLibraryFileException'); // ALGO COVER (method)
     $this->libraryDiscoveryParser->buildByExtension('invalid_file');
   }
 
   /**
    * Tests that an exception is thrown when no CSS/JS/setting is specified.
    *
-   * @expectedException \Drupal\Core\Asset\Exception\IncompleteLibraryDefinitionException
-   * @expectedExceptionMessage Incomplete library definition for definition 'example' in extension 'example_module_missing_information'
-   *
    * @covers ::buildByExtension
    */
   public function testBuildByExtensionWithMissingInformation() {
@@ -178,6 +174,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase {
     $path = substr($path, strlen($this->root) + 1);
     $this->libraryDiscoveryParser->setPaths('module', 'example_module_missing_information', $path);
 
+    $this->setExpectedException('\Drupal\Core\Asset\Exception\IncompleteLibraryDefinitionException', "Incomplete library definition for definition 'example' in extension 'example_module_missing_information'"); // ALGO COVER (method)
     $this->libraryDiscoveryParser->buildByExtension('example_module_missing_information');
   }
 
@@ -276,8 +273,6 @@ class LibraryDiscoveryParserTest extends UnitTestCase {
   /**
    * Ensures that you cannot provide positive weights for JavaScript libraries.
    *
-   * @expectedException \UnexpectedValueException
-   *
    * @covers ::buildByExtension
    */
   public function testJsWithPositiveWeight() {
@@ -290,6 +285,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase {
     $path = substr($path, strlen($this->root) + 1);
     $this->libraryDiscoveryParser->setPaths('module', 'js_positive_weight', $path);
 
+    $this->setExpectedException('\UnexpectedValueException'); // ALGO COVER (method)
     $this->libraryDiscoveryParser->buildByExtension('js_positive_weight');
   }
 
@@ -403,9 +399,6 @@ class LibraryDiscoveryParserTest extends UnitTestCase {
   /**
    * Tests that an exception is thrown when license is missing when 3rd party.
    *
-   * @expectedException \Drupal\Core\Asset\Exception\LibraryDefinitionMissingLicenseException
-   * @expectedExceptionMessage Missing license information in library definition for definition 'no-license-info-but-remote' extension 'licenses_missing_information': it has a remote, but no license.
-   *
    * @covers ::buildByExtension
    */
   public function testLibraryThirdPartyWithMissingLicense() {
@@ -418,6 +411,7 @@ class LibraryDiscoveryParserTest extends UnitTestCase {
     $path = substr($path, strlen($this->root) + 1);
     $this->libraryDiscoveryParser->setPaths('module', 'licenses_missing_information', $path);
 
+    $this->setExpectedException('\Drupal\Core\Asset\Exception\LibraryDefinitionMissingLicenseException', "Missing license information in library definition for definition 'no-license-info-but-remote' extension 'licenses_missing_information': it has a remote, but no license."); // ALGO COVER (method)
     $this->libraryDiscoveryParser->buildByExtension('licenses_missing_information');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php b/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php
index 32ea0d0..3ee57f3 100644
--- a/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbManagerTest.php
@@ -183,8 +183,6 @@ class BreadcrumbManagerTest extends UnitTestCase {
 
   /**
    * Tests a breadcrumb builder with a bad return value.
-   *
-   * @expectedException \UnexpectedValueException
    */
   public function testBuildWithInvalidBreadcrumbResult() {
     $builder = $this->getMock('Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface');
@@ -196,6 +194,7 @@ class BreadcrumbManagerTest extends UnitTestCase {
       ->will($this->returnValue('invalid_result'));
 
     $this->breadcrumbManager->addBuilder($builder, 0);
+    $this->setExpectedException('\UnexpectedValueException'); // ALGO LAST
     $this->breadcrumbManager->build($this->getMock('Drupal\Core\Routing\RouteMatchInterface'));
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php b/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php
index ca8acfc..2013aa9 100644
--- a/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php
+++ b/core/tests/Drupal/Tests/Core/Breadcrumb/BreadcrumbTest.php
@@ -15,11 +15,10 @@ 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();
+    $this->setExpectedException('\LogicException', 'Once breadcrumb links are set, only additional breadcrumb links can be added.'); // ALGO COVER (method)
     $breadcrumb->setLinks([new Link('Home', Url::fromRoute('<front>'))]);
     $breadcrumb->setLinks([new Link('None', Url::fromRoute('<none>'))]);
   }
diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php
index edb220a..91145ef 100644
--- a/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/CacheTagsInvalidatorTest.php
@@ -14,11 +14,10 @@ class CacheTagsInvalidatorTest extends UnitTestCase {
 
   /**
    * @covers ::invalidateTags
-   *
-   * @expectedException \AssertionError
    */
   public function testInvalidateTagsWithInvalidTags() {
     $cache_tags_invalidator = new CacheTagsInvalidator();
+    $this->setExpectedException('\AssertionError'); // ALGO COVER (method)
     $cache_tags_invalidator->invalidateTags(['node' => [2, 3, 5, 8, 13]]);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php
index 0bc9d7f..4fa0c6d 100644
--- a/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php
@@ -105,27 +105,25 @@ class CacheContextsManagerTest extends UnitTestCase {
 
   /**
    * @covers ::convertTokensToKeys
-   *
-   * @expectedException \AssertionError
    */
   public function testInvalidContext() {
     $container = $this->getMockContainer();
     $cache_contexts_manager = new CacheContextsManager($container, $this->getContextsFixture());
 
+    $this->setExpectedException('\AssertionError'); // ALGO COVER (method)
     $cache_contexts_manager->convertTokensToKeys(["non-cache-context"]);
   }
 
   /**
    * @covers ::convertTokensToKeys
    *
-   * @expectedException \Exception
-   *
    * @dataProvider providerTestInvalidCalculatedContext
    */
   public function testInvalidCalculatedContext($context_token) {
     $container = $this->getMockContainer();
     $cache_contexts_manager = new CacheContextsManager($container, $this->getContextsFixture());
 
+    $this->setExpectedException('\Exception'); // ALGO COVER (method)
     $cache_contexts_manager->convertTokensToKeys([$context_token]);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php
index 223d890..28a3384 100644
--- a/core/tests/Drupal/Tests/Core/Config/ConfigTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/ConfigTest.php
@@ -230,18 +230,18 @@ class ConfigTest extends UnitTestCase {
 
   /**
    * @covers ::set
-   * @expectedException \Drupal\Core\Config\ConfigValueException
    */
   public function testSetValidation() {
+    $this->setExpectedException('\Drupal\Core\Config\ConfigValueException'); // ALGO COVER (method)
     $this->config->set('testData', array('dot.key' => 1));
   }
 
   /**
    * @covers ::set
-   * @expectedException PHPUnit_Framework_Error_Warning
    */
   public function testSetIllegalOffsetValue() {
     // Set a single value.
+    $this->setExpectedException('PHPUnit_Framework_Error_Warning'); // ALGO COVER (method)
     $this->config->set('testData', 1);
 
     // Attempt to treat the single value as a nested item.
@@ -383,7 +383,6 @@ class ConfigTest extends UnitTestCase {
 
   /**
    * @covers ::validateName
-   * @expectedException \Drupal\Core\Config\ConfigNameException
    * @dataProvider validateNameProvider
    */
   public function testValidateNameException($name, $exception_message) {
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
index 4710765..32db8ea 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
@@ -567,13 +567,12 @@ class ConfigEntityBaseUnitTest extends UnitTestCase {
 
   /**
    * @covers ::toArray
-   *
-   * @expectedException \Drupal\Core\Config\Schema\SchemaIncompleteException
    */
   public function testToArrayFallback() {
     $this->entityType->expects($this->any())
       ->method('getPropertiesToExport')
       ->willReturn([]);
+    $this->setExpectedException('\Drupal\Core\Config\Schema\SchemaIncompleteException'); // ALGO COVER (method)
     $this->entity->toArray();
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php
index 6f02023..17106c0 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php
@@ -470,23 +470,19 @@ class ConfigEntityStorageTest extends UnitTestCase {
 
   /**
    * @covers ::save
-   *
-   * @expectedException \Drupal\Core\Entity\EntityMalformedException
-   * @expectedExceptionMessage The entity does not have an ID.
    */
   public function testSaveInvalid() {
     $this->cacheTagsInvalidator->expects($this->never())
       ->method('invalidateTags');
 
     $entity = $this->getMockEntity();
+    $this->setExpectedException('\Drupal\Core\Entity\EntityMalformedException', 'The entity does not have an ID.'); // ALGO COVER (method)
     $this->entityStorage->save($entity);
   }
 
   /**
    * @covers ::save
    * @covers ::doSave
-   *
-   * @expectedException \Drupal\Core\Entity\EntityStorageException
    */
   public function testSaveDuplicate() {
     $config_object = $this->getMockBuilder('Drupal\Core\Config\Config')
@@ -511,15 +507,13 @@ class ConfigEntityStorageTest extends UnitTestCase {
     $entity = $this->getMockEntity(array('id' => 'foo'));
     $entity->enforceIsNew();
 
+    $this->setExpectedException('\Drupal\Core\Entity\EntityStorageException'); // ALGO COVER (method)
     $this->entityStorage->save($entity);
   }
 
   /**
    * @covers ::save
    * @covers ::doSave
-   *
-   * @expectedException \Drupal\Core\Config\ConfigDuplicateUUIDException
-   * @expectedExceptionMessage when this UUID is already used for
    */
   public function testSaveMismatch() {
     $config_object = $this->getMockBuilder('Drupal\Core\Config\Config')
@@ -547,6 +541,7 @@ class ConfigEntityStorageTest extends UnitTestCase {
       ->will($this->returnValue(array('baz')));
 
     $entity = $this->getMockEntity(array('id' => 'foo'));
+    $this->setExpectedException('\Drupal\Core\Config\ConfigDuplicateUUIDException', 'when this UUID is already used for'); // ALGO COVER (method)
     $this->entityStorage->save($entity);
   }
 
@@ -600,9 +595,6 @@ class ConfigEntityStorageTest extends UnitTestCase {
   /**
    * @covers ::save
    * @covers ::doSave
-   *
-   * @expectedException \Drupal\Core\Config\ConfigDuplicateUUIDException
-   * @expectedExceptionMessage when this entity already exists with UUID
    */
   public function testSaveChangedUuid() {
     $config_object = $this->getMockBuilder('Drupal\Core\Config\Config')
@@ -665,6 +657,7 @@ class ConfigEntityStorageTest extends UnitTestCase {
     $entity = $this->getMockEntity(array('id' => 'foo'));
 
     $entity->set('uuid', 'baz');
+    $this->setExpectedException('\Drupal\Core\Config\ConfigDuplicateUUIDException', 'when this entity already exists with UUID'); // ALGO COVER (method)
     $this->entityStorage->save($entity);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php
index b131b26..b61b6f5 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php
@@ -79,11 +79,9 @@ class ConfigEntityTypeTest extends UnitTestCase {
 
   /**
    * @covers ::__construct
-   *
-   * @expectedException \Drupal\Core\Config\Entity\Exception\ConfigEntityStorageClassException
-   * @expectedExceptionMessage \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage is not \Drupal\Core\Config\Entity\ConfigEntityStorage or it does not extend it
    */
   public function testConstructBadStorage() {
+    $this->setExpectedException('\Drupal\Core\Config\Entity\Exception\ConfigEntityStorageClassException', '\Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage is not \Drupal\Core\Config\Entity\ConfigEntityStorage or it does not extend it'); // ALGO COVER (body)
     new ConfigEntityType([
       'id' => 'example_config_entity_type',
       'handlers' => ['storage' => '\Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage']
@@ -92,12 +90,10 @@ class ConfigEntityTypeTest extends UnitTestCase {
 
   /**
    * @covers ::setStorageClass
-   *
-   * @expectedException \Drupal\Core\Config\Entity\Exception\ConfigEntityStorageClassException
-   * @expectedExceptionMessage \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage is not \Drupal\Core\Config\Entity\ConfigEntityStorage or it does not extend it
    */
   public function testSetStorageClass() {
     $config_entity = $this->setUpConfigEntityType([]);
+    $this->setExpectedException('\Drupal\Core\Config\Entity\Exception\ConfigEntityStorageClassException', '\Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage is not \Drupal\Core\Config\Entity\ConfigEntityStorage or it does not extend it'); // ALGO COVER (method)
     $config_entity->setStorageClass('\Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php
index 75fe625..64beafb 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/Query/QueryFactoryTest.php
@@ -96,8 +96,6 @@ class QueryFactoryTest extends UnitTestCase {
   }
 
   /**
-   * @expectedException \LogicException
-   * @expectedExceptionMessage test_config_entity_type lookup key test.* ends with a wildcard this can not be used as a lookup
    */
   public function testGetKeysWildCardEnd() {
     $config_factory = $this->getMock('Drupal\Core\Config\ConfigFactoryInterface');
@@ -111,6 +109,7 @@ class QueryFactoryTest extends UnitTestCase {
 
     $method = new \ReflectionMethod($query_factory, 'getKeys');
     $method->setAccessible(TRUE);
+    $this->setExpectedException('\LogicException', 'test_config_entity_type lookup key test.* ends with a wildcard this can not be used as a lookup'); // ALGO LAST
     $method->invoke($query_factory, $this->getConfigObject('test'), 'test.*', 'get', $config_entity_type);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Config/ImmutableConfigTest.php b/core/tests/Drupal/Tests/Core/Config/ImmutableConfigTest.php
index 5b5c498..b1d9952 100644
--- a/core/tests/Drupal/Tests/Core/Config/ImmutableConfigTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/ImmutableConfigTest.php
@@ -28,37 +28,33 @@ class ImmutableConfigTest extends UnitTestCase {
 
   /**
    * @covers ::set
-   * @expectedException \Drupal\Core\Config\ImmutableConfigException
-   * @expectedExceptionMessage Can not set values on immutable configuration test:name. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object
    */
   public function testSet() {
+    $this->setExpectedException('\Drupal\Core\Config\ImmutableConfigException', 'Can not set values on immutable configuration test:name. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object'); // ALGO COVER (method)
     $this->config->set('name', 'value');
   }
 
   /**
    * @covers ::clear
-   * @expectedException \Drupal\Core\Config\ImmutableConfigException
-   * @expectedExceptionMessage Can not clear name key in immutable configuration test. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object
    */
   public function testClear() {
+    $this->setExpectedException('\Drupal\Core\Config\ImmutableConfigException', 'Can not clear name key in immutable configuration test. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object'); // ALGO COVER (method)
     $this->config->clear('name');
   }
 
   /**
    * @covers ::save
-   * @expectedException \Drupal\Core\Config\ImmutableConfigException
-   * @expectedExceptionMessage Can not save immutable configuration test. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object
    */
   public function testSave() {
+    $this->setExpectedException('\Drupal\Core\Config\ImmutableConfigException', 'Can not save immutable configuration test. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object'); // ALGO COVER (method)
     $this->config->save();
   }
 
   /**
    * @covers ::delete
-   * @expectedException \Drupal\Core\Config\ImmutableConfigException
-   * @expectedExceptionMessage Can not delete immutable configuration test. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object
    */
   public function testDelete() {
+    $this->setExpectedException('\Drupal\Core\Config\ImmutableConfigException', 'Can not delete immutable configuration test. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object'); // ALGO COVER (method)
     $this->config->delete();
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php
index 98a18a3..502573f 100644
--- a/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php
+++ b/core/tests/Drupal/Tests/Core/Controller/ControllerResolverTest.php
@@ -120,19 +120,17 @@ class ControllerResolverTest extends UnitTestCase {
 
   /**
    * Tests createController() with a non-existent class.
-   *
-   * @expectedException \InvalidArgumentException
    */
   public function testCreateControllerNonExistentClass() {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO ONE
     $this->controllerResolver->getControllerFromDefinition('Class::method');
   }
 
   /**
    * Tests createController() with an invalid name.
-   *
-   * @expectedException \LogicException
    */
   public function testCreateControllerInvalidName() {
+    $this->setExpectedException('\LogicException'); // ALGO ONE
     $this->controllerResolver->getControllerFromDefinition('ClassWithoutMethod');
   }
 
@@ -191,10 +189,9 @@ class ControllerResolverTest extends UnitTestCase {
   }
   /**
    * Tests getControllerFromDefinition() without a callable.
-   *
-   * @expectedException \InvalidArgumentException
    */
   public function testGetControllerFromDefinitionNotCallable() {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO ONE
     $this->controllerResolver->getControllerFromDefinition('Drupal\Tests\Core\Controller\MockController::bananas');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Database/ConditionTest.php b/core/tests/Drupal/Tests/Core/Database/ConditionTest.php
index f33e3c3..ea65c03 100644
--- a/core/tests/Drupal/Tests/Core/Database/ConditionTest.php
+++ b/core/tests/Drupal/Tests/Core/Database/ConditionTest.php
@@ -139,8 +139,6 @@ class ConditionTest extends UnitTestCase {
 
   /**
    * @covers ::compile
-   *
-   * @expectedException \PHPUnit_Framework_Error
    * @dataProvider providerTestCompileWithSqlInjectionForOperator
    */
   public function testCompileWithSqlInjectionForOperator($operator) {
@@ -162,6 +160,7 @@ class ConditionTest extends UnitTestCase {
 
     $condition = new Condition('AND');
     $condition->condition('name', 'value', $operator);
+    $this->setExpectedException('\PHPUnit_Framework_Error'); // ALGO COVER (method)
     $condition->compile($connection, $query_placeholder);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php
index b43971d..e39931e 100644
--- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php
+++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php
@@ -64,14 +64,13 @@ class ProxyServicesPassTest extends UnitTestCase {
 
   /**
    * @covers ::process
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
    */
   public function testContainerWithLazyServicesWithoutProxyClass() {
     $container = new ContainerBuilder();
     $container->register('alias_whitelist', 'Drupal\Core\Path\AliasWhitelist')
       ->setLazy(TRUE);
 
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException'); // ALGO COVER (method)
     $this->proxyServicesPass->process($container);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php
index 2eeb603..d1d1c8c 100644
--- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php
+++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/TaggedHandlersPassTest.php
@@ -43,9 +43,6 @@ class TaggedHandlersPassTest extends UnitTestCase {
 
   /**
    * Tests a required consumer with no handlers.
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
-   * @expectedExceptionMessage At least one service tagged with 'consumer_id' is required.
    * @covers ::process
    */
   public function testProcessRequiredHandlers() {
@@ -57,14 +54,12 @@ class TaggedHandlersPassTest extends UnitTestCase {
       ));
 
     $handler_pass = new TaggedHandlersPass();
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\LogicException', "At least one service tagged with 'consumer_id' is required."); // ALGO COVER (method)
     $handler_pass->process($container);
   }
 
   /**
    * Tests consumer with missing interface in non-production environment.
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
-   * @expectedExceptionMessage Service consumer 'consumer_id' class method Drupal\Tests\Core\DependencyInjection\Compiler\InvalidConsumer::addHandler() has to type-hint an interface.
    * @covers ::process
    */
   public function testProcessMissingInterface() {
@@ -74,6 +69,7 @@ class TaggedHandlersPassTest extends UnitTestCase {
       ->addTag('service_collector');
 
     $handler_pass = new TaggedHandlersPass();
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\LogicException', "Service consumer 'consumer_id' class method Drupal\Tests\Core\DependencyInjection\Compiler\InvalidConsumer::addHandler() has to type-hint an interface."); // ALGO COVER (method)
     $handler_pass->process($container);
   }
 
@@ -203,8 +199,6 @@ class TaggedHandlersPassTest extends UnitTestCase {
 
   /**
    * Tests interface validation in non-production environment.
-   *
-   * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
    * @covers ::process
    */
   public function testProcessInterfaceMismatch() {
@@ -223,6 +217,7 @@ class TaggedHandlersPassTest extends UnitTestCase {
       ));
 
     $handler_pass = new TaggedHandlersPass();
+    $this->setExpectedException('\Symfony\Component\DependencyInjection\Exception\LogicException'); // ALGO COVER (method)
     $handler_pass->process($container);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php
index 4a6eae7..96802c7 100644
--- a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php
@@ -35,43 +35,39 @@ class ContainerBuilderTest extends UnitTestCase {
 
   /**
    * @covers ::set
-   * @expectedException \InvalidArgumentException
-   * @expectedExceptionMessage Service ID names must be lowercase: Bar
    */
   public function testSetException() {
     $container = new ContainerBuilder();
     $class = new BarClass();
+    $this->setExpectedException('\InvalidArgumentException', 'Service ID names must be lowercase: Bar'); // ALGO COVER (method)
     $container->set('Bar', $class);
     $this->assertNotEquals('bar', $class->_serviceId);
   }
 
   /**
    * @covers ::setParameter
-   * @expectedException \InvalidArgumentException
-   * @expectedExceptionMessage Parameter names must be lowercase: Buzz
    */
   public function testSetParameterException() {
     $container = new ContainerBuilder();
+    $this->setExpectedException('\InvalidArgumentException', 'Parameter names must be lowercase: Buzz'); // ALGO COVER (method)
     $container->setParameter('Buzz', 'buzz');
   }
 
   /**
    * @covers ::register
-   * @expectedException \InvalidArgumentException
-   * @expectedExceptionMessage Service ID names must be lowercase: Bar
    */
   public function testRegisterException() {
     $container = new ContainerBuilder();
+    $this->setExpectedException('\InvalidArgumentException', 'Service ID names must be lowercase: Bar'); // ALGO COVER (method)
     $container->register('Bar');
   }
 
   /**
    * Tests serialization.
-   *
-   * @expectedException \AssertionError
    */
   public function testSerialize() {
     $container = new ContainerBuilder();
+    $this->setExpectedException('\AssertionError'); // ALGO LAST
     serialize($container);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerTest.php
index 0ae5dd5..168c2cd 100644
--- a/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerTest.php
+++ b/core/tests/Drupal/Tests/Core/DependencyInjection/ContainerTest.php
@@ -14,11 +14,10 @@ class ContainerTest extends UnitTestCase {
 
   /**
    * Tests serialization.
-   *
-   * @expectedException \AssertionError
    */
   public function testSerialize() {
     $container = new Container();
+    $this->setExpectedException('\AssertionError'); // ALGO LAST
     serialize($container);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/DrupalTest.php b/core/tests/Drupal/Tests/Core/DrupalTest.php
index de94bf8..e030660 100644
--- a/core/tests/Drupal/Tests/Core/DrupalTest.php
+++ b/core/tests/Drupal/Tests/Core/DrupalTest.php
@@ -43,11 +43,9 @@ class DrupalTest extends UnitTestCase {
 
   /**
    * @covers ::getContainer
-   *
-   * @expectedException \Drupal\Core\DependencyInjection\ContainerNotInitializedException
-   * @expectedExceptionMessage \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container.
    */
   public function testGetContainerException() {
+    $this->setExpectedException('\Drupal\Core\DependencyInjection\ContainerNotInitializedException', '\Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container.'); // ALGO COVER (method)
     \Drupal::getContainer();
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php b/core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php
index dbd50e7..383397f 100644
--- a/core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/BaseFieldDefinitionTest.php
@@ -298,11 +298,11 @@ class BaseFieldDefinitionTest extends UnitTestCase {
    * Tests invalid default value callbacks.
    *
    * @covers ::setDefaultValueCallback
-   * @expectedException \InvalidArgumentException
    */
   public function testInvalidDefaultValueCallback() {
     $definition = BaseFieldDefinition::create($this->fieldType);
     // setDefaultValueCallback returns $this.
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (body)
     $this->assertSame($definition,
       $definition->setDefaultValueCallback([get_class($this), 'mockDefaultValueCallback'])
     );
diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
index cb73533..a933095 100644
--- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
@@ -352,9 +352,6 @@ class ContentEntityBaseUnitTest extends UnitTestCase {
    * @covers ::setValidationRequired
    * @covers ::save
    * @covers ::preSave
-   *
-   * @expectedException \LogicException
-   * @expectedExceptionMessage Entity validation was skipped.
    */
   public function testRequiredValidation() {
     $validator = $this->getMock('\Symfony\Component\Validator\ValidatorInterface');
@@ -392,6 +389,7 @@ class ContentEntityBaseUnitTest extends UnitTestCase {
     // can be saved normally.
     $this->entity->setValidationRequired(TRUE);
     $this->assertTrue($this->entity->isValidationRequired());
+    $this->setExpectedException('\LogicException', 'Entity validation was skipped.'); // ALGO COVER (method)
     $this->entity->validate();
     $this->entity->save();
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php
index 7cad93c..ce63d6c 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php
@@ -310,9 +310,6 @@ class EntityFieldManagerTest extends UnitTestCase {
    * @covers ::getBaseFieldDefinitions
    * @covers ::buildBaseFieldDefinitions
    *
-   * @expectedException \LogicException
-   * @expectedExceptionMessage The Test entity type cannot be translatable as it does not define a translatable "langcode" field.
-   *
    * @dataProvider providerTestGetBaseFieldDefinitionsTranslatableEntityTypeLangcode
    */
   public function testGetBaseFieldDefinitionsTranslatableEntityTypeLangcode($provide_key, $provide_field, $translatable) {
@@ -333,6 +330,7 @@ class EntityFieldManagerTest extends UnitTestCase {
     $this->entityType->isTranslatable()->willReturn(TRUE);
     $this->entityType->getLabel()->willReturn('Test');
 
+    $this->setExpectedException('\LogicException', 'The Test entity type cannot be translatable as it does not define a translatable "langcode" field.'); // ALGO COVER (method)
     $this->entityFieldManager->getBaseFieldDefinitions('test_entity_type');
   }
 
@@ -452,8 +450,6 @@ class EntityFieldManagerTest extends UnitTestCase {
    *
    * @covers ::getBaseFieldDefinitions
    * @covers ::buildBaseFieldDefinitions
-   *
-   * @expectedException \LogicException
    */
   public function testGetBaseFieldDefinitionsInvalidDefinition() {
     $this->setUpEntityWithFieldDefinition(FALSE, 'langcode', ['langcode' => 'langcode']);
@@ -461,6 +457,7 @@ class EntityFieldManagerTest extends UnitTestCase {
     $this->entityType->isTranslatable()->willReturn(TRUE);
     $this->entityType->getLabel()->willReturn('the_label');
 
+    $this->setExpectedException('\LogicException'); // ALGO COVER (method)
     $this->entityFieldManager->getBaseFieldDefinitions('test_entity_type');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php
index c2325d4..ee0145d 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php
@@ -248,14 +248,13 @@ class EntityTypeManagerTest extends UnitTestCase {
    * Tests the getFormObject() method with an invalid operation.
    *
    * @covers ::getFormObject
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
    */
   public function testGetFormObjectInvalidOperation() {
     $entity = $this->prophesize(EntityTypeInterface::class);
     $entity->getFormClass('edit')->willReturn('');
     $this->setUpEntityTypeDefinitions(['test_entity_type' => $entity]);
 
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException'); // ALGO COVER (method)
     $this->entityTypeManager->getFormObject('test_entity_type', 'edit');
   }
 
@@ -283,13 +282,12 @@ class EntityTypeManagerTest extends UnitTestCase {
    * Tests the getHandler() method when no controller is defined.
    *
    * @covers ::getHandler
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
    */
   public function testGetHandlerMissingHandler() {
     $entity = $this->prophesize(EntityTypeInterface::class);
     $entity->getHandlerClass('storage')->willReturn('');
     $this->setUpEntityTypeDefinitions(['test_entity_type' => $entity]);
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException'); // ALGO COVER (method)
     $this->entityTypeManager->getHandler('test_entity_type', 'storage');
   }
 
@@ -314,9 +312,6 @@ class EntityTypeManagerTest extends UnitTestCase {
    * Tests the processDefinition() method.
    *
    * @covers ::processDefinition
-   *
-   * @expectedException \Drupal\Core\Entity\Exception\InvalidLinkTemplateException
-   * @expectedExceptionMessage Link template 'canonical' for entity type 'apple' must start with a leading slash, the current link template is 'path/to/apple'
    */
   public function testProcessDefinition() {
     $apple = $this->prophesize(EntityTypeInterface::class);
@@ -325,6 +320,7 @@ class EntityTypeManagerTest extends UnitTestCase {
     $apple->getLinkTemplates()->willReturn(['canonical' => 'path/to/apple']);
 
     $definition = $apple->reveal();
+    $this->setExpectedException('\Drupal\Core\Entity\Exception\InvalidLinkTemplateException', "Link template 'canonical' for entity type 'apple' must start with a leading slash, the current link template is 'path/to/apple'"); // ALGO COVER (method)
     $this->entityTypeManager->processDefinition($definition, 'apple');
   }
 
@@ -370,13 +366,11 @@ class EntityTypeManagerTest extends UnitTestCase {
    * Tests the getDefinition() method with an invalid definition.
    *
    * @covers ::getDefinition
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginNotFoundException
-   * @expectedExceptionMessage The "pear" entity type does not exist.
    */
   public function testGetDefinitionInvalidException() {
     $this->setUpEntityTypeDefinitions();
 
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginNotFoundException', 'The "pear" entity type does not exist.'); // ALGO COVER (method)
     $this->entityTypeManager->getDefinition('pear', TRUE);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php
index 3761e0d..781ab2c 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php
@@ -130,9 +130,6 @@ class EntityTypeRepositoryTest extends UnitTestCase {
 
   /**
    * @covers ::getEntityTypeFromClass
-   *
-   * @expectedException \Drupal\Core\Entity\Exception\NoCorrespondingEntityClassException
-   * @expectedExceptionMessage The \Drupal\pear\Entity\Pear class does not correspond to an entity type.
    */
   public function testGetEntityTypeFromClassNoMatch() {
     $apple = $this->prophesize(EntityTypeInterface::class);
@@ -146,14 +143,12 @@ class EntityTypeRepositoryTest extends UnitTestCase {
     $apple->getOriginalClass()->willReturn('\Drupal\apple\Entity\Apple');
     $banana->getOriginalClass()->willReturn('\Drupal\banana\Entity\Banana');
 
+    $this->setExpectedException('\Drupal\Core\Entity\Exception\NoCorrespondingEntityClassException', 'The \Drupal\pear\Entity\Pear class does not correspond to an entity type.'); // ALGO COVER (method)
     $this->entityTypeRepository->getEntityTypeFromClass('\Drupal\pear\Entity\Pear');
   }
 
   /**
    * @covers ::getEntityTypeFromClass
-   *
-   * @expectedException \Drupal\Core\Entity\Exception\AmbiguousEntityClassException
-   * @expectedExceptionMessage Multiple entity types found for \Drupal\apple\Entity\Apple.
    */
   public function testGetEntityTypeFromClassAmbiguous() {
     $boskoop = $this->prophesize(EntityTypeInterface::class);
@@ -169,6 +164,7 @@ class EntityTypeRepositoryTest extends UnitTestCase {
       'gala' => $gala,
     ]);
 
+    $this->setExpectedException('\Drupal\Core\Entity\Exception\AmbiguousEntityClassException', 'Multiple entity types found for \Drupal\apple\Entity\Apple.'); // ALGO COVER (method)
     $this->entityTypeRepository->getEntityTypeFromClass('\Drupal\apple\Entity\Apple');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
index d633afc..f121492 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
@@ -390,11 +390,10 @@ class EntityTypeTest extends UnitTestCase {
 
   /**
    * @covers ::setLinkTemplate
-   *
-   * @expectedException \InvalidArgumentException
    */
   public function testSetLinkTemplateWithInvalidPath() {
     $entity_type = $this->setUpEntityType(['id' => $this->randomMachineName()]);
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (method)
     $entity_type->setLinkTemplate('test', 'invalid-path');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php
index 4fbdba3..4ed0c50 100644
--- a/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/KeyValueStore/KeyValueEntityStorageTest.php
@@ -439,14 +439,12 @@ class KeyValueEntityStorageTest extends UnitTestCase {
   /**
    * @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->setExpectedException('\Drupal\Core\Entity\EntityMalformedException', 'The entity does not have an ID.'); // ALGO COVER (method)
     $this->entityStorage->save($entity);
     $this->keyValueStore->expects($this->never())
       ->method('has');
@@ -459,9 +457,6 @@ class KeyValueEntityStorageTest extends UnitTestCase {
   /**
    * @covers ::save
    * @covers ::doSave
-   *
-   * @expectedException \Drupal\Core\Entity\EntityStorageException
-   * @expectedExceptionMessage 'test_entity_type' entity with ID 'foo' already exists
    */
   public function testSaveDuplicate() {
     $this->setUpKeyValueEntityStorage();
@@ -475,6 +470,7 @@ class KeyValueEntityStorageTest extends UnitTestCase {
       ->method('set');
     $this->keyValueStore->expects($this->never())
       ->method('delete');
+    $this->setExpectedException('\Drupal\Core\Entity\EntityStorageException', "'test_entity_type' entity with ID 'foo' already exists"); // ALGO COVER (method)
     $this->entityStorage->save($entity);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php b/core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php
index 22c606d..8bfeeca 100644
--- a/core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/Query/Sql/QueryTest.php
@@ -36,11 +36,9 @@ class QueryTest extends UnitTestCase {
    * Tests entity query for entity type without base table.
    *
    * @covers ::prepare
-   *
-   * @expectedException \Drupal\Core\Entity\Query\QueryException
-   * @expectedExceptionMessage No base table for example_entity_query, invalid query.
    */
   public function testNoBaseTable() {
+    $this->setExpectedException('\Drupal\Core\Entity\Query\QueryException', 'No base table for example_entity_query, invalid query.'); // ALGO ONE
     $this->query->execute();
   }
 
@@ -48,11 +46,9 @@ class QueryTest extends UnitTestCase {
    * Tests revision entity query for entity type without revision table.
    *
    * @covers ::prepare
-   *
-   * @expectedException \Drupal\Core\Entity\Query\QueryException
-   * @expectedExceptionMessage No revision table for example_entity_query, invalid query.
    */
   public function testNoRevisionTable() {
+    $this->setExpectedException('\Drupal\Core\Entity\Query\QueryException', 'No revision table for example_entity_query, invalid query.'); // ALGO ONE
     $this->query->allRevisions()->execute();
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
index 8ce420b..394adf1 100644
--- a/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
@@ -294,9 +294,6 @@ class DefaultTableMappingTest extends UnitTestCase {
    * @param string $column
    *   The name of the column to be processed.
    *
-   * @expectedException \Drupal\Core\Entity\Sql\SqlContentEntityStorageException
-   * @expectedExceptionMessage Column information not available for the 'test' field.
-   *
    * @covers ::getFieldColumnName
    *
    * @dataProvider providerTestGetFieldColumnName
@@ -310,6 +307,7 @@ class DefaultTableMappingTest extends UnitTestCase {
       ->willReturn(TRUE);
 
     $table_mapping = new DefaultTableMapping($this->entityType, $definitions);
+    $this->setExpectedException('\Drupal\Core\Entity\Sql\SqlContentEntityStorageException', "Column information not available for the 'test' field."); // ALGO COVER (method)
     $table_mapping->getFieldColumnName($definitions['test'], $column);
   }
 
@@ -440,13 +438,11 @@ class DefaultTableMappingTest extends UnitTestCase {
   /**
    * Tests DefaultTableMapping::getFieldTableName() with an invalid parameter.
    *
-   * @expectedException \Drupal\Core\Entity\Sql\SqlContentEntityStorageException
-   * @expectedExceptionMessage Table information not available for the 'invalid_field_name' field.
-   *
    * @covers ::getFieldTableName
    */
   public function testGetFieldTableNameInvalid() {
     $table_mapping = new DefaultTableMapping($this->entityType, []);
+    $this->setExpectedException('\Drupal\Core\Entity\Sql\SqlContentEntityStorageException', "Table information not available for the 'invalid_field_name' field."); // ALGO COVER (method)
     $table_mapping->getFieldTableName('invalid_field_name');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php
index 646f17a..f1d35ab 100644
--- a/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php
@@ -275,18 +275,18 @@ class EntityAdapterUnitTest extends UnitTestCase {
 
   /**
    * @covers ::get
-   * @expectedException \InvalidArgumentException
    */
   public function testGetInvalidField() {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (method)
     $this->entityAdapter->get('invalid');
   }
 
   /**
    * @covers ::get
-   * @expectedException \Drupal\Core\TypedData\Exception\MissingDataException
    */
   public function testGetWithoutData() {
     $this->entityAdapter->setValue(NULL);
+    $this->setExpectedException('\Drupal\Core\TypedData\Exception\MissingDataException'); // ALGO COVER (method)
     $this->entityAdapter->get('id');
   }
 
@@ -305,11 +305,11 @@ class EntityAdapterUnitTest extends UnitTestCase {
 
   /**
    * @covers ::set
-   * @expectedException \Drupal\Core\TypedData\Exception\MissingDataException
    */
   public function testSetWithoutData() {
     $this->entityAdapter->setValue(NULL);
     $id_items = [ array('value' => $this->id + 1) ];
+    $this->setExpectedException('\Drupal\Core\TypedData\Exception\MissingDataException'); // ALGO COVER (method)
     $this->entityAdapter->set('id', $id_items);
   }
 
@@ -335,10 +335,10 @@ class EntityAdapterUnitTest extends UnitTestCase {
 
   /**
    * @covers ::toArray
-   * @expectedException \Drupal\Core\TypedData\Exception\MissingDataException
    */
   public function testToArrayWithoutData() {
     $this->entityAdapter->setValue(NULL);
+    $this->setExpectedException('\Drupal\Core\TypedData\Exception\MissingDataException'); // ALGO COVER (method)
     $this->entityAdapter->toArray();
   }
 
diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php
index b945b14..737cc39 100644
--- a/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php
+++ b/core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php
@@ -115,8 +115,6 @@ class RedirectResponseSubscriberTest extends UnitTestCase {
 
   /**
    * @dataProvider providerTestDestinationRedirectToExternalUrl
-   *
-   * @expectedException \PHPUnit_Framework_Error
    */
   public function testDestinationRedirectToExternalUrl($request, $expected) {
     $dispatcher = new EventDispatcher();
@@ -126,6 +124,7 @@ class RedirectResponseSubscriberTest extends UnitTestCase {
     $listener = new RedirectResponseSubscriber($this->urlAssembler, $this->requestContext);
     $dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'checkRedirectUrl'));
     $event = new FilterResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST, $response);
+    $this->setExpectedException('\PHPUnit_Framework_Error'); // ALGO ASSERT
     $dispatcher->dispatch(KernelEvents::RESPONSE, $event);
 
     $this->assertEquals(400, $event->getResponse()->getStatusCode());
@@ -165,7 +164,6 @@ class RedirectResponseSubscriberTest extends UnitTestCase {
   }
 
   /**
-   * @expectedException \PHPUnit_Framework_Error
    *
    * @dataProvider providerTestDestinationRedirectWithInvalidUrl
    */
@@ -177,6 +175,7 @@ class RedirectResponseSubscriberTest extends UnitTestCase {
     $listener = new RedirectResponseSubscriber($this->urlAssembler, $this->requestContext);
     $dispatcher->addListener(KernelEvents::RESPONSE, array($listener, 'checkRedirectUrl'));
     $event = new FilterResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST, $response);
+    $this->setExpectedException('\PHPUnit_Framework_Error'); // ALGO ASSERT
     $dispatcher->dispatch(KernelEvents::RESPONSE, $event);
 
     $this->assertEquals(400, $event->getResponse()->getStatusCode());
diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php
index 55db07e..57ac7ed 100644
--- a/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php
+++ b/core/tests/Drupal/Tests/Core/EventSubscriber/SpecialAttributesRouteSubscriberTest.php
@@ -89,8 +89,6 @@ class SpecialAttributesRouteSubscriberTest extends UnitTestCase {
    *   The route to check.
    *
    * @dataProvider providerTestOnRouteBuildingInvalidVariables
-   * @expectedException \PHPUnit_Framework_Error_Warning
-   * @expectedExceptionMessage uses reserved variable names
    *
    * @covers ::onAlterRoutes
    */
@@ -100,6 +98,7 @@ class SpecialAttributesRouteSubscriberTest extends UnitTestCase {
 
     $event = new RouteBuildEvent($route_collection, 'test');
     $subscriber = new SpecialAttributesRouteSubscriber();
+    $this->setExpectedException('\PHPUnit_Framework_Error_Warning', 'uses reserved variable names'); // ALGO COVER (method)
     $subscriber->onAlterRoutes($event);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php
index 74a7649..924167d 100644
--- a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php
@@ -50,9 +50,6 @@ class InfoParserUnitTest extends UnitTestCase {
    * Test if correct exception is thrown for a broken info file.
    *
    * @covers ::parse
-   *
-   * @expectedException \Drupal\Core\Extension\InfoParserException
-   * @expectedExceptionMessageRegExp #broken\.info\.txt#
    */
   public function testInfoParserBroken() {
     $broken_info = <<<BROKEN_INFO
@@ -74,6 +71,7 @@ BROKEN_INFO;
       ],
     ]);
     $filename = vfsStream::url('modules/fixtures/broken.info.txt');
+    $this->setExpectedException('\Drupal\Core\Extension\InfoParserException', 'broken.info.txt');
     $this->infoParser->parse($filename);
   }
 
@@ -82,8 +80,6 @@ BROKEN_INFO;
    *
    * @covers ::parse
    *
-   * @expectedException \Drupal\Core\Extension\InfoParserException
-   * @expectedExceptionMessageRegExp #Missing required keys \(type, core, name\) in .+?missing_keys\.info\.txt#
    */
   public function testInfoParserMissingKeys() {
     $missing_keys = <<<MISSINGKEYS
@@ -101,6 +97,7 @@ MISSINGKEYS;
       ],
     ]);
     $filename = vfsStream::url('modules/fixtures/missing_keys.info.txt');
+    $this->setExpectedException('\Drupal\Core\Extension\InfoParserException', 'Missing required keys (type, core, name) in vfs://modules/fixtures/missing_keys.info.txt');
     $this->infoParser->parse($filename);
   }
 
@@ -108,9 +105,6 @@ MISSINGKEYS;
    * Tests that missing required key is detected.
    *
    * @covers ::parse
-   *
-   * @expectedException \Drupal\Core\Extension\InfoParserException
-   * @expectedExceptionMessageRegExp #Missing required keys \(type\) in .+?missing_key\.info\.txt#
    */
   public function testInfoParserMissingKey() {
     $missing_key = <<<MISSINGKEY
@@ -131,6 +125,7 @@ MISSINGKEY;
       ],
     ]);
     $filename = vfsStream::url('modules/fixtures/missing_key.info.txt');
+    $this->setExpectedException('\Drupal\Core\Extension\InfoParserException', 'Missing required keys (type) in vfs://modules/fixtures/missing_key.info.txt');
     $this->infoParser->parse($filename);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
index aa45b3b..0b757a0 100644
--- a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
+++ b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
@@ -146,10 +146,9 @@ class ModuleHandlerTest extends UnitTestCase {
 
   /**
    * @covers ::getModule
-   *
-   * @expectedException \InvalidArgumentException
    */
   public function testGetModuleWithNonExistingModule() {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (method)
     $this->moduleHandler->getModule('claire_alice_watch_my_little_pony_module_that_does_not_exist');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php b/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php
index 18d270e..50dd6ab 100644
--- a/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/ConfigFormBaseTraitTest.php
@@ -41,8 +41,6 @@ class ConfigFormBaseTraitTest extends UnitTestCase {
 
   /**
    * @covers ::config
-   * @expectedException \LogicException
-   * @expectedExceptionMessage No config factory available for ConfigFormBaseTrait
    */
   public function testConfigFactoryException() {
     $trait = $this->getMockForTrait('Drupal\Core\Form\ConfigFormBaseTrait');
@@ -50,13 +48,12 @@ class ConfigFormBaseTraitTest extends UnitTestCase {
     $config_method->setAccessible(TRUE);
 
     // There is no config factory available this should result in an exception.
+    $this->setExpectedException('\LogicException', 'No config factory available for ConfigFormBaseTrait'); // ALGO LAST
     $config_method->invoke($trait, 'editable.config');
   }
 
   /**
    * @covers ::config
-   * @expectedException \LogicException
-   * @expectedExceptionMessage No config factory available for ConfigFormBaseTrait
    */
   public function testConfigFactoryExceptionInvalidProperty() {
     $trait = $this->getMockForTrait('Drupal\Core\Form\ConfigFormBaseTrait');
@@ -65,6 +62,7 @@ class ConfigFormBaseTraitTest extends UnitTestCase {
     $config_method->setAccessible(TRUE);
 
     // There is no config factory available this should result in an exception.
+    $this->setExpectedException('\LogicException', 'No config factory available for ConfigFormBaseTrait'); // ALGO LAST
     $config_method->invoke($trait, 'editable.config');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php b/core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php
index 067ba47..2b93c7e 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormAjaxResponseBuilderTest.php
@@ -43,8 +43,6 @@ class FormAjaxResponseBuilderTest extends UnitTestCase {
 
   /**
    * @covers ::buildResponse
-   *
-   * @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
    */
   public function testBuildResponseNoTriggeringElement() {
     $this->renderer->expects($this->never())
@@ -56,13 +54,12 @@ class FormAjaxResponseBuilderTest extends UnitTestCase {
     $commands = [];
 
     $expected = [];
+    $this->setExpectedException('\Symfony\Component\HttpKernel\Exception\HttpException'); // ALGO COVER (body)
     $this->assertSame($expected, $this->formAjaxResponseBuilder->buildResponse($request, $form, $form_state, $commands));
   }
 
   /**
    * @covers ::buildResponse
-   *
-   * @expectedException \Symfony\Component\HttpKernel\Exception\HttpException
    */
   public function testBuildResponseNoCallable() {
     $this->renderer->expects($this->never())
@@ -76,6 +73,7 @@ class FormAjaxResponseBuilderTest extends UnitTestCase {
     $commands = [];
 
     $expected = [];
+    $this->setExpectedException('\Symfony\Component\HttpKernel\Exception\HttpException'); // ALGO COVER (body)
     $this->assertSame($expected, $this->formAjaxResponseBuilder->buildResponse($request, $form, $form_state, $commands));
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
index dfbf843..6b1f3f6 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
@@ -52,15 +52,13 @@ class FormBuilderTest extends FormTestBase {
 
   /**
    * Tests the getFormId() method with a string based form ID.
-   *
-   * @expectedException \InvalidArgumentException
-   * @expectedExceptionMessage The form argument foo is not a valid form.
    */
   public function testGetFormIdWithString() {
     $form_arg = 'foo';
 
     $clean_form_state = new FormState();
     $form_state = new FormState();
+    $this->setExpectedException('\InvalidArgumentException', 'The form argument foo is not a valid form.'); // ALGO ASSERT
     $form_id = $this->formBuilder->getFormId($form_arg, $form_state);
 
     $this->assertSame($form_arg, $form_id);
@@ -218,14 +216,12 @@ class FormBuilderTest extends FormTestBase {
 
   /**
    * Tests the getForm() method with a string based form ID.
-   *
-   * @expectedException \InvalidArgumentException
-   * @expectedExceptionMessage The form argument test_form_id is not a valid form.
    */
   public function testGetFormWithString() {
     $form_id = 'test_form_id';
     $expected_form = $form_id();
 
+    $this->setExpectedException('\InvalidArgumentException', 'The form argument test_form_id is not a valid form.'); // ALGO ASSERT
     $form = $this->formBuilder->getForm($form_id);
     $this->assertFormElement($expected_form, $form, 'test');
     $this->assertSame('test-form-id', $form['#id']);
@@ -262,14 +258,12 @@ class FormBuilderTest extends FormTestBase {
 
   /**
    * Tests the buildForm() method with a string based form ID.
-   *
-   * @expectedException \InvalidArgumentException
-   * @expectedExceptionMessage The form argument test_form_id is not a valid form.
    */
   public function testBuildFormWithString() {
     $form_id = 'test_form_id';
     $expected_form = $form_id();
 
+    $this->setExpectedException('\InvalidArgumentException', 'The form argument test_form_id is not a valid form.'); // ALGO ASSERT
     $form = $this->formBuilder->getForm($form_id);
     $this->assertFormElement($expected_form, $form, 'test');
     $this->assertArrayHasKey('#id', $form);
@@ -547,8 +541,6 @@ class FormBuilderTest extends FormTestBase {
 
   /**
    * @covers ::buildForm
-   *
-   * @expectedException \Drupal\Core\Form\Exception\BrokenPostRequestException
    */
   public function testExceededFileSize() {
     $request = new Request([FormBuilderInterface::AJAX_FORM_REQUEST => TRUE]);
@@ -565,6 +557,7 @@ class FormBuilderTest extends FormTestBase {
     $form_arg = $this->getMockForm('test_form_id');
     $form_state = new FormState();
 
+    $this->setExpectedException('\Drupal\Core\Form\Exception\BrokenPostRequestException'); // ALGO COVER (method)
     $this->formBuilder->buildForm($form_arg, $form_state);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php
index 67e7a86..5805900 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormStateDecoratorBaseTest.php
@@ -158,10 +158,9 @@ class FormStateDecoratorBaseTest extends UnitTestCase {
    * @dataProvider providerSingleBooleanArgument
    *
    * @param bool $cache
-   *
-   * @expectedException \LogicException
    */
   public function testSetCachedWithLogicException($cache) {
+    $this->setExpectedException('\LogicException'); // ALGO COVER (body)
     $this->decoratedFormState->setCached($cache)
       ->willThrow(\LogicException::class);
 
diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateTest.php
index 69118a8..4ffb8e6 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormStateTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormStateTest.php
@@ -132,13 +132,11 @@ class FormStateTest extends UnitTestCase {
    * Tests that form errors during submission throw an exception.
    *
    * @covers ::setErrorByName
-   *
-   * @expectedException \LogicException
-   * @expectedExceptionMessage Form errors cannot be set after form validation has finished.
    */
   public function testFormErrorsDuringSubmission() {
     $form_state = new FormState();
     $form_state->setValidationComplete();
+    $this->setExpectedException('\LogicException', 'Form errors cannot be set after form validation has finished.'); // ALGO COVER (method)
     $form_state->setErrorByName('test', 'message');
   }
 
@@ -315,13 +313,11 @@ class FormStateTest extends UnitTestCase {
 
   /**
    * @covers ::setCached
-   *
-   * @expectedException \LogicException
-   * @expectedExceptionMessage Form state caching on GET requests is not allowed.
    */
   public function testSetCachedGet() {
     $form_state = new FormState();
     $form_state->setRequestMethod('GET');
+    $this->setExpectedException('\LogicException', 'Form state caching on GET requests is not allowed.'); // ALGO COVER (method)
     $form_state->setCached();
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Form/SubformStateTest.php b/core/tests/Drupal/Tests/Core/Form/SubformStateTest.php
index ec2ac8b..1502e33 100644
--- a/core/tests/Drupal/Tests/Core/Form/SubformStateTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/SubformStateTest.php
@@ -97,12 +97,11 @@ class SubformStateTest extends UnitTestCase {
    *
    * @dataProvider providerGetValuesBroken
    *
-   * @expectedException \UnexpectedValueException
-   *
    * @param string[] $parents
    * @param string $expected
    */
   public function testGetValuesBroken(array $parents, $expected) {
+    $this->setExpectedException('\UnexpectedValueException'); // ALGO ONE
     $this->testGetValues($parents, $expected);
   }
 
@@ -161,10 +160,9 @@ class SubformStateTest extends UnitTestCase {
    * @covers ::getValue
    *
    * @dataProvider providerTestGetValueBroken
-   *
-   * @expectedException \UnexpectedValueException
    */
   public function testGetValueBroken(array $parents, $key, $expected, $default = NULL) {
+    $this->setExpectedException('\UnexpectedValueException'); // ALGO ONE
     $this->testGetValue($parents, $key, $expected, $default);
   }
 
@@ -217,10 +215,9 @@ class SubformStateTest extends UnitTestCase {
    * @covers ::setValues
    *
    * @dataProvider providerTestSetValuesBroken
-   *
-   * @expectedException \UnexpectedValueException
    */
   public function testSetValuesBroken($parents, $new_values, $expected) {
+    $this->setExpectedException('\UnexpectedValueException'); // ALGO ONE
     $this->testSetValues($parents, $new_values, $expected);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php
index b3f0151..ff2a808 100644
--- a/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php
@@ -203,8 +203,6 @@ class ContextualLinkManagerTest extends UnitTestCase {
    * Tests processDefinition() by passing a plugin definition without a route.
    *
    * @see \Drupal\Core\Menu\ContextualLinkManager::processDefinition()
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginException
    */
   public function testProcessDefinitionWithoutRoute() {
     $definition = array(
@@ -212,6 +210,7 @@ class ContextualLinkManagerTest extends UnitTestCase {
       'group' => 'example',
       'id' => 'test_plugin',
     );
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginException'); // ALGO LAST
     $this->contextualLinkManager->processDefinition($definition, 'test_plugin');
   }
 
@@ -219,8 +218,6 @@ class ContextualLinkManagerTest extends UnitTestCase {
    * Tests processDefinition() by passing a plugin definition without a group.
    *
    * @see \Drupal\Core\Menu\ContextualLinkManager::processDefinition()
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginException
    */
   public function testProcessDefinitionWithoutGroup() {
     $definition = array(
@@ -228,6 +225,7 @@ class ContextualLinkManagerTest extends UnitTestCase {
       'route_name' => 'example',
       'id' => 'test_plugin',
     );
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginException'); // ALGO LAST
     $this->contextualLinkManager->processDefinition($definition, 'test_plugin');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/PageCache/ChainRequestPolicyTest.php b/core/tests/Drupal/Tests/Core/PageCache/ChainRequestPolicyTest.php
index 82a6581..9f544c4 100644
--- a/core/tests/Drupal/Tests/Core/PageCache/ChainRequestPolicyTest.php
+++ b/core/tests/Drupal/Tests/Core/PageCache/ChainRequestPolicyTest.php
@@ -62,8 +62,6 @@ class ChainRequestPolicyTest extends UnitTestCase {
 
   /**
    * Asserts that check() throws an exception if a rule returns an invalid value.
-   *
-   * @expectedException \UnexpectedValueException
    * @dataProvider providerChainExceptionOnInvalidReturnValue
    * @covers ::check
    */
@@ -76,6 +74,7 @@ class ChainRequestPolicyTest extends UnitTestCase {
 
     $this->policy->addPolicy($rule);
 
+    $this->setExpectedException('\UnexpectedValueException'); // ALGO COVER (method)
     $this->policy->check($this->request);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php b/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php
index 1575ac1..c6703af 100644
--- a/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php
+++ b/core/tests/Drupal/Tests/Core/PageCache/ChainResponsePolicyTest.php
@@ -71,8 +71,6 @@ class ChainResponsePolicyTest extends UnitTestCase {
 
   /**
    * Asserts that check() throws an exception if a rule returns an invalid value.
-   *
-   * @expectedException \UnexpectedValueException
    * @dataProvider providerChainExceptionOnInvalidReturnValue
    * @covers ::check
    */
@@ -85,6 +83,7 @@ class ChainResponsePolicyTest extends UnitTestCase {
 
     $this->policy->addPolicy($rule);
 
+    $this->setExpectedException('\UnexpectedValueException'); // ALGO COVER (body)
     $actual_result = $this->policy->check($this->response, $this->request);
     $this->assertSame(NULL, $actual_result);
   }
diff --git a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
index ebafab0..d94c728 100644
--- a/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
+++ b/core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php
@@ -110,8 +110,6 @@ class EntityConverterTest extends UnitTestCase {
 
   /**
    * Tests the convert() method with an invalid entity type.
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
    */
   public function testConvertWithInvalidEntityType() {
     $this->entityManager->expects($this->once())
@@ -119,16 +117,15 @@ class EntityConverterTest extends UnitTestCase {
       ->with('invalid_id')
       ->willThrowException(new InvalidPluginDefinitionException('invalid_id'));
 
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException'); // ALGO LAST
     $this->entityConverter->convert('id', ['type' => 'entity:invalid_id'], 'foo', ['foo' => 'id']);
   }
 
   /**
    * Tests the convert() method with an invalid dynamic entity type.
-   *
-   * @expectedException \Drupal\Core\ParamConverter\ParamNotConvertedException
-   * @expectedExceptionMessage The "foo" parameter was not converted because the "invalid_id" parameter is missing
    */
   public function testConvertWithInvalidDynamicEntityType() {
+    $this->setExpectedException('\Drupal\Core\ParamConverter\ParamNotConvertedException', 'The "foo" parameter was not converted because the "invalid_id" parameter is missing'); // ALGO ONE
     $this->entityConverter->convert('id', ['type' => 'entity:{invalid_id}'], 'foo', ['foo' => 'id']);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php b/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php
index cc248b0..a82e6b2 100644
--- a/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php
@@ -51,10 +51,9 @@ class ParamConverterManagerTest extends UnitTestCase {
    * Tests \Drupal\Core\ParamConverter\ParamConverterManager::getConverter().
    *
    * @covers ::getConverter
-   *
-   * @expectedException \InvalidArgumentException
    */
   public function testGetConverterException() {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (method)
     $this->manager->getConverter('undefined.converter');
   }
 
@@ -220,9 +219,6 @@ class ParamConverterManagerTest extends UnitTestCase {
 
   /**
    * @covers ::convert
-   *
-   * @expectedException \Drupal\Core\ParamConverter\ParamNotConvertedException
-   * @expectedExceptionMessage The "id" parameter was not converted for the path "/test/{id}" (route name: "test_route")
    */
   public function testConvertMissingParam() {
     $route = new Route('/test/{id}');
@@ -246,6 +242,7 @@ class ParamConverterManagerTest extends UnitTestCase {
       ->will($this->returnValue(NULL));
     $this->manager->addConverter($converter, 'test_convert');
 
+    $this->setExpectedException('\Drupal\Core\ParamConverter\ParamNotConvertedException', 'The "id" parameter was not converted for the path "/test/{id}" (route name: "test_route")'); // ALGO COVER (method)
     $this->manager->convert($defaults);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorFrontTest.php b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorFrontTest.php
index 4076f1e..f9319e4 100644
--- a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorFrontTest.php
+++ b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorFrontTest.php
@@ -47,7 +47,6 @@ class PathProcessorFrontTest extends UnitTestCase {
    * Test inbound failure with broken config.
    *
    * @covers ::processInbound
-   * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
    */
   public function testProcessInboundBadConfig() {
     $config_factory = $this->prophesize(ConfigFactoryInterface::class);
@@ -57,6 +56,7 @@ class PathProcessorFrontTest extends UnitTestCase {
     $config->get('page.front')
       ->willReturn('');
     $processor = new PathProcessorFront($config_factory->reveal());
+    $this->setExpectedException('\Symfony\Component\HttpKernel\Exception\NotFoundHttpException'); // ALGO COVER (method)
     $processor->processInbound('/', new Request());
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php
index fb1a442..32226e9 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionTest.php
@@ -107,7 +107,6 @@ class ContextDefinitionTest extends UnitTestCase {
   }
 
   /**
-   * @expectedException \Exception
    * @dataProvider providerGetDataDefinition
    * @covers ::getDataDefinition
    * @uses \Drupal
@@ -155,6 +154,7 @@ class ContextDefinitionTest extends UnitTestCase {
       ->method('getDataType')
       ->willReturn($data_type);
 
+    $this->setExpectedException('\Exception'); // ALGO COVER (body)
     $this->assertSame(
       $mock_data_definition,
       $mock_context_definition->getDataDefinition()
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php b/core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php
index 02fea32..44c035a 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php
@@ -66,11 +66,10 @@ class LazyContextRepositoryTest extends UnitTestCase {
 
   /**
    * @covers ::getRuntimeContexts
-   * @expectedException \InvalidArgumentException
-   * @expectedExceptionMessage You must provide the context IDs in the @{service_id}:{unqualified_context_id} format.
    */
   public function testInvalidContextId() {
     $lazy_context_repository = new LazyContextRepository($this->container, ['test_provider']);
+    $this->setExpectedException('\InvalidArgumentException', 'You must provide the context IDs in the @{service_id}:{unqualified_context_id} format.'); // ALGO COVER (method)
     $lazy_context_repository->getRuntimeContexts(['test_context', '@test_provider:test_context1']);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php b/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php
index 981f4c2..6a7a663 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php
@@ -279,9 +279,6 @@ class ContextHandlerTest extends UnitTestCase {
 
   /**
    * @covers ::applyContextMapping
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\ContextException
-   * @expectedExceptionMessage Required contexts without a value: hit.
    */
   public function testApplyContextMappingMissingRequired() {
     $context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
@@ -311,6 +308,7 @@ class ContextHandlerTest extends UnitTestCase {
     $plugin->expects($this->never())
       ->method('getContext');
 
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\ContextException', 'Required contexts without a value: hit.'); // ALGO COVER (method)
     $this->contextHandler->applyContextMapping($plugin, $contexts);
   }
 
@@ -350,9 +348,6 @@ class ContextHandlerTest extends UnitTestCase {
 
   /**
    * @covers ::applyContextMapping
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\ContextException
-   * @expectedExceptionMessage Required contexts without a value: hit.
    */
   public function testApplyContextMappingNoValueRequired() {
     $context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
@@ -381,6 +376,7 @@ class ContextHandlerTest extends UnitTestCase {
     $plugin->expects($this->never())
       ->method('setContextValue');
 
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\ContextException', 'Required contexts without a value: hit.'); // ALGO COVER (method)
     $this->contextHandler->applyContextMapping($plugin, $contexts);
   }
 
@@ -464,9 +460,6 @@ class ContextHandlerTest extends UnitTestCase {
 
   /**
    * @covers ::applyContextMapping
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\ContextException
-   * @expectedExceptionMessage Assigned contexts were not satisfied: miss
    */
   public function testApplyContextMappingConfigurableAssignedMiss() {
     $context = $this->getMock('Drupal\Core\Plugin\Context\ContextInterface');
@@ -489,6 +482,7 @@ class ContextHandlerTest extends UnitTestCase {
     $plugin->expects($this->never())
       ->method('setContextValue');
 
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\ContextException', 'Assigned contexts were not satisfied: miss'); // ALGO COVER (method)
     $this->contextHandler->applyContextMapping($plugin, $contexts, ['miss' => 'name']);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultLazyPluginCollectionTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultLazyPluginCollectionTest.php
index fbd6bc2..06d4315 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/DefaultLazyPluginCollectionTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultLazyPluginCollectionTest.php
@@ -43,11 +43,10 @@ class DefaultLazyPluginCollectionTest extends LazyPluginCollectionTestBase {
 
   /**
    * @covers ::get
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginNotFoundException
-   * @expectedExceptionMessage Plugin ID 'pear' was not found.
    */
   public function testGetNotExistingPlugin() {
     $this->setupPluginCollection();
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginNotFoundException', "Plugin ID 'pear' was not found."); // ALGO COVER (method)
     $this->defaultPluginCollection->get('pear');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
index ffdac5a..7b5bcc2 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
@@ -270,9 +270,6 @@ class DefaultPluginManagerTest extends UnitTestCase {
    * Tests plugins without the proper interface.
    *
    * @covers ::createInstance
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginException
-   * @expectedExceptionMessage Plugin "kale" (Drupal\plugin_test\Plugin\plugin_test\fruit\Kale) must implement interface \Drupal\plugin_test\Plugin\plugin_test\fruit\FruitInterface
    */
   public function testCreateInstanceWithInvalidInterfaces() {
     $module_handler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
@@ -293,6 +290,7 @@ class DefaultPluginManagerTest extends UnitTestCase {
     $this->expectedDefinitions['banana']['provider'] = 'plugin_test';
 
     $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions, $module_handler, NULL, '\Drupal\plugin_test\Plugin\plugin_test\fruit\FruitInterface');
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginException', 'Plugin "kale" (Drupal\plugin_test\Plugin\plugin_test\fruit\Kale) must implement interface \Drupal\plugin_test\Plugin\plugin_test\fruit\FruitInterface'); // ALGO COVER (method)
     $plugin_manager->createInstance('kale');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
index d81360f..efbfa7e 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
@@ -86,9 +86,6 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase {
    * Tests the getDerivativeFetcher method with a non-existent class.
    *
    * @see \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDeriver().\
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\InvalidDeriverException
-   * @expectedExceptionMessage Plugin (non_existent_discovery) deriver "\Drupal\system\Tests\Plugin\NonExistentDeriver" does not exist.
    */
   public function testNonExistentDerivativeFetcher() {
     $definitions = array();
@@ -102,6 +99,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase {
       ->will($this->returnValue($definitions));
 
     $discovery = new DerivativeDiscoveryDecorator($this->discoveryMain);
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\InvalidDeriverException', 'Plugin (non_existent_discovery) deriver "\Drupal\system\Tests\Plugin\NonExistentDeriver" does not exist.'); // ALGO LAST
     $discovery->getDefinitions();
   }
 
@@ -109,9 +107,6 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase {
    * Tests the getDerivativeFetcher method with an invalid class.
    *
    * @see \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator::getDeriver().\
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\InvalidDeriverException
-   * @expectedExceptionMessage Plugin (invalid_discovery) deriver "\Drupal\KernelTests\Core\Plugin\DerivativeTest" must implement \Drupal\Component\Plugin\Derivative\DeriverInterface.
    */
   public function testInvalidDerivativeFetcher() {
     $definitions = array();
@@ -125,6 +120,7 @@ class DerivativeDiscoveryDecoratorTest extends UnitTestCase {
       ->will($this->returnValue($definitions));
 
     $discovery = new DerivativeDiscoveryDecorator($this->discoveryMain);
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\InvalidDeriverException', 'Plugin (invalid_discovery) deriver "\Drupal\KernelTests\Core\Plugin\DerivativeTest" must implement \Drupal\Component\Plugin\Derivative\DeriverInterface.'); // ALGO LAST
     $discovery->getDefinitions();
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/HookDiscoveryTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/HookDiscoveryTest.php
index 1472dc0..5e4bb5b 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/HookDiscoveryTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/HookDiscoveryTest.php
@@ -118,14 +118,13 @@ class HookDiscoveryTest extends UnitTestCase {
    * Tests the getDefinition method with an unknown plugin ID.
    *
    * @see \Drupal\Core\Plugin\Discovery::getDefinition()
-   *
-   * @expectedException \Drupal\Component\Plugin\Exception\PluginNotFoundException
    */
   public function testGetDefinitionWithUnknownID() {
     $this->moduleHandler->expects($this->once())
       ->method('getImplementations')
       ->will($this->returnValue(array()));
 
+    $this->setExpectedException('\Drupal\Component\Plugin\Exception\PluginNotFoundException'); // ALGO LAST
     $this->hookDiscovery->getDefinition('test_non_existant', TRUE);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Render/ElementTest.php b/core/tests/Drupal/Tests/Core/Render/ElementTest.php
index 604d391..5bc4abd 100644
--- a/core/tests/Drupal/Tests/Core/Render/ElementTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/ElementTest.php
@@ -101,14 +101,12 @@ class ElementTest extends UnitTestCase {
 
   /**
    * Tests the children() method with an invalid key.
-   *
-   * @expectedException \PHPUnit_Framework_Error
-   * @expectedExceptionMessage "foo" is an invalid render array key
    */
   public function testInvalidChildren() {
     $element = array(
       'foo' => 'bar',
     );
+    $this->setExpectedException('\PHPUnit_Framework_Error', '"foo" is an invalid render array key'); // ALGO LAST
     Element::children($element);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php b/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php
index fc90e5d..5aadb4e 100644
--- a/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/Placeholder/ChainedPlaceholderStrategyTest.php
@@ -120,9 +120,6 @@ class ChainedPlaceholderStrategyTest extends UnitTestCase {
 
   /**
    * @covers ::processPlaceholders
-   *
-   * @expectedException \AssertionError
-   * @expectedExceptionMessage At least one placeholder strategy must be present; by default the fallback strategy \Drupal\Core\Render\Placeholder\SingleFlushStrategy is always present.
    */
   public function testProcessPlaceholdersNoStrategies() {
     // Placeholders but no strategies defined.
@@ -131,14 +128,12 @@ class ChainedPlaceholderStrategyTest extends UnitTestCase {
     ];
 
     $chained_placeholder_strategy = new ChainedPlaceholderStrategy();
+    $this->setExpectedException('\AssertionError', 'At least one placeholder strategy must be present; by default the fallback strategy \Drupal\Core\Render\Placeholder\SingleFlushStrategy is always present.'); // ALGO COVER (method)
     $chained_placeholder_strategy->processPlaceholders($placeholders);
   }
 
   /**
    * @covers ::processPlaceholders
-   *
-   * @expectedException \AssertionError
-   * @expectedExceptionMessage Processed placeholders must be a subset of all placeholders.
    */
   public function testProcessPlaceholdersWithRoguePlaceholderStrategy() {
     // Placeholders but no strategies defined.
@@ -157,6 +152,7 @@ class ChainedPlaceholderStrategyTest extends UnitTestCase {
 
     $chained_placeholder_strategy = new ChainedPlaceholderStrategy();
     $chained_placeholder_strategy->addPlaceholderStrategy($rogue_strategy);
+    $this->setExpectedException('\AssertionError', 'Processed placeholders must be a subset of all placeholders.'); // ALGO COVER (method)
     $chained_placeholder_strategy->processPlaceholders($placeholders);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php
index a3835e1..031ec73 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php
@@ -570,9 +570,6 @@ class RendererBubblingTest extends RendererTestBase {
 
   /**
    * Tests that an element's cache keys cannot be changed during its rendering.
-   *
-   * @expectedException \LogicException
-   * @expectedExceptionMessage Cache keys may not be changed after initial setup. Use the contexts property instead to bubble additional metadata.
    */
   public function testOverWriteCacheKeys() {
     $this->setUpRequest();
@@ -585,6 +582,7 @@ class RendererBubblingTest extends RendererTestBase {
        ],
       '#pre_render' => [__NAMESPACE__ . '\\BubblingTest::bubblingCacheOverwritePrerender'],
     ];
+    $this->setExpectedException('\LogicException', 'Cache keys may not be changed after initial setup. Use the contexts property instead to bubble additional metadata.'); // ALGO LAST
     $this->renderer->renderRoot($data);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
index 530f603..34fbebf 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
@@ -846,28 +846,24 @@ class RendererPlaceholdersTest extends RendererTestBase {
   /**
    * @covers ::render
    * @covers ::doRender
-   *
-   * @expectedException \DomainException
-   * @expectedExceptionMessage The #lazy_builder property must have an array as a value.
    */
   public function testInvalidLazyBuilder() {
     $element = [];
     $element['#lazy_builder'] = '\Drupal\Tests\Core\Render\PlaceholdersTest::callback';
 
+    $this->setExpectedException('\DomainException', 'The #lazy_builder property must have an array as a value.'); // ALGO LAST
     $this->renderer->renderRoot($element);
   }
 
   /**
    * @covers ::render
    * @covers ::doRender
-   *
-   * @expectedException \DomainException
-   * @expectedExceptionMessage The #lazy_builder property must have an array as a value, containing two values: the callback, and the arguments for the callback.
    */
   public function testInvalidLazyBuilderArguments() {
     $element = [];
     $element['#lazy_builder'] = ['\Drupal\Tests\Core\Render\PlaceholdersTest::callback', 'arg1', 'arg2'];
 
+    $this->setExpectedException('\DomainException', 'The #lazy_builder property must have an array as a value, containing two values: the callback, and the arguments for the callback.'); // ALGO LAST
     $this->renderer->renderRoot($element);
   }
 
@@ -895,9 +891,6 @@ class RendererPlaceholdersTest extends RendererTestBase {
   /**
    * @covers ::render
    * @covers ::doRender
-   *
-   * @expectedException \DomainException
-   * @expectedExceptionMessage A #lazy_builder callback's context may only contain scalar values or NULL.
    */
   public function testNonScalarLazybuilderCallbackContext() {
     $element = [];
@@ -911,15 +904,13 @@ class RendererPlaceholdersTest extends RendererTestBase {
       'array' => ['hi!'],
     ]];
 
+    $this->setExpectedException('\DomainException', "A #lazy_builder callback's context may only contain scalar values or NULL."); // ALGO LAST
     $this->renderer->renderRoot($element);
   }
 
   /**
    * @covers ::render
    * @covers ::doRender
-   *
-   * @expectedException \DomainException
-   * @expectedExceptionMessage When a #lazy_builder callback is specified, no children can exist; all children must be generated by the #lazy_builder callback. You specified the following children: child_a, child_b.
    */
   public function testChildrenPlusBuilder() {
     $element = [];
@@ -927,15 +918,13 @@ class RendererPlaceholdersTest extends RendererTestBase {
     $element['child_a']['#markup'] = 'Oh hai!';
     $element['child_b']['#markup'] = 'kthxbai';
 
+    $this->setExpectedException('\DomainException', 'When a #lazy_builder callback is specified, no children can exist; all children must be generated by the #lazy_builder callback. You specified the following children: child_a, child_b.'); // ALGO LAST
     $this->renderer->renderRoot($element);
   }
 
   /**
    * @covers ::render
    * @covers ::doRender
-   *
-   * @expectedException \DomainException
-   * @expectedExceptionMessage When a #lazy_builder callback is specified, no properties can exist; all properties must be generated by the #lazy_builder callback. You specified the following properties: #llama, #piglet.
    */
   public function testPropertiesPlusBuilder() {
     $element = [];
@@ -943,20 +932,19 @@ class RendererPlaceholdersTest extends RendererTestBase {
     $element['#llama'] = '#awesome';
     $element['#piglet'] = '#cute';
 
+    $this->setExpectedException('\DomainException', 'When a #lazy_builder callback is specified, no properties can exist; all properties must be generated by the #lazy_builder callback. You specified the following properties: #llama, #piglet.'); // ALGO LAST
     $this->renderer->renderRoot($element);
   }
 
   /**
    * @covers ::render
    * @covers ::doRender
-   *
-   * @expectedException \LogicException
-   * @expectedExceptionMessage When #create_placeholder is set, a #lazy_builder callback must be present as well.
    */
   public function testCreatePlaceholderPropertyWithoutLazyBuilder() {
     $element = [];
     $element['#create_placeholder'] = TRUE;
 
+    $this->setExpectedException('\LogicException', 'When #create_placeholder is set, a #lazy_builder callback must be present as well.'); // ALGO LAST
     $this->renderer->renderRoot($element);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php b/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php
index bffbd22..7529025 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php
@@ -31,8 +31,6 @@ class RendererRecursionTest extends RendererTestBase {
    * @covers ::renderRoot
    * @covers ::render
    * @covers ::doRender
-   *
-   * @expectedException \LogicException
    */
   public function testRenderRecursionWithNestedRenderRoot() {
     list($complex_child_markup, $parent_markup, $complex_child_template) = $this->setUpRenderRecursionComplexElements();
@@ -41,7 +39,8 @@ class RendererRecursionTest extends RendererTestBase {
 
     $complex_child = $complex_child_template;
     $callable = function () use ($renderer, $complex_child) {
-      $renderer->renderRoot($complex_child);
+      $this->setExpectedException('\LogicException'); // ALGO COVER (method)
+    $renderer->renderRoot($complex_child);
     };
 
     $page = [
diff --git a/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php b/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php
index 0b7bcc6..c55ef4c 100644
--- a/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php
@@ -87,8 +87,6 @@ class AccessAwareRouterTest extends UnitTestCase {
 
   /**
    * Tests the matchRequest() function for access denied.
-   *
-   * @expectedException \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
    */
   public function testMatchRequestDenied() {
     $this->setupRouter();
@@ -98,6 +96,7 @@ class AccessAwareRouterTest extends UnitTestCase {
       ->method('checkRequest')
       ->with($request)
       ->willReturn($access_result);
+    $this->setExpectedException('\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException'); // ALGO ASSERT
     $parameters = $this->router->matchRequest($request);
     $expected = [
       AccessAwareRouterInterface::ACCESS_RESULT => $access_result,
diff --git a/core/tests/Drupal/Tests/Core/Routing/RequestFormatRouteFilterTest.php b/core/tests/Drupal/Tests/Core/Routing/RequestFormatRouteFilterTest.php
index 39a960b..e5f6f85 100644
--- a/core/tests/Drupal/Tests/Core/Routing/RequestFormatRouteFilterTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/RequestFormatRouteFilterTest.php
@@ -61,8 +61,6 @@ class RequestFormatRouteFilterTest extends UnitTestCase {
 
   /**
    * @covers ::filter
-   * @expectedException \Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException
-   * @expectedExceptionMessage No route found for the specified format xml.
    */
   public function testNoRouteFound() {
     $collection = new RouteCollection();
@@ -74,6 +72,7 @@ class RequestFormatRouteFilterTest extends UnitTestCase {
     $request = Request::create('test?_format=xml', 'GET');
     $request->setRequestFormat('xml');
     $route_filter = new RequestFormatRouteFilter();
+    $this->setExpectedException('\Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException', 'No route found for the specified format xml.'); // ALGO COVER (method)
     $route_filter->filter($collection, $request);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php b/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php
index 0cfbad5..8a0b9a3 100644
--- a/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/TrustedRedirectResponseTest.php
@@ -29,7 +29,6 @@ class TrustedRedirectResponseTest extends UnitTestCase {
 
   /**
    * @covers ::setTargetUrl
-   * @expectedException \InvalidArgumentException
    */
   public function testSetTargetUrlWithUntrustedUrl() {
     $request_context = new RequestContext();
@@ -40,6 +39,7 @@ class TrustedRedirectResponseTest extends UnitTestCase {
 
     $redirect_response = new TrustedRedirectResponse('/example');
 
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (method)
     $redirect_response->setTargetUrl('http://evil-url.com/example');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
index 3cf50fc..399f552 100644
--- a/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
+++ b/core/tests/Drupal/Tests/Core/Site/SettingsTest.php
@@ -80,12 +80,11 @@ class SettingsTest extends UnitTestCase {
    * @covers ::getHashSalt
    *
    * @dataProvider providerTestGetHashSaltEmpty
-   *
-   * @expectedException \RuntimeException
    */
   public function testGetHashSaltEmpty(array $config) {
     // Re-create settings with no 'hash_salt' key.
     $settings = new Settings($config);
+    $this->setExpectedException('\RuntimeException'); // ALGO COVER (method)
     $settings->getHashSalt();
   }
 
@@ -106,10 +105,9 @@ class SettingsTest extends UnitTestCase {
    * Ensures settings cannot be serialized.
    *
    * @covers ::__sleep
-   *
-   * @expectedException \LogicException
    */
   public function testSerialize() {
+    $this->setExpectedException('\LogicException'); // ALGO ONE
     serialize(new Settings([]));
   }
 
diff --git a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php
index 3ed2b3d..ec350d2 100644
--- a/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php
+++ b/core/tests/Drupal/Tests/Core/StringTranslation/TranslatableMarkupTest.php
@@ -82,24 +82,22 @@ class TranslatableMarkupTest extends UnitTestCase {
   }
 
   /**
-   * @expectedException \InvalidArgumentException
-   * @expectedExceptionMessage $string ("foo") must be a string.
    *
    * @covers ::__construct
    */
   public function testIsStringAssertion() {
     $translation = $this->getStringTranslationStub();
+    $this->setExpectedException('\InvalidArgumentException', '$string ("foo") must be a string.'); // ALGO COVER (body)
     new TranslatableMarkup(new TranslatableMarkup('foo', [], [], $translation));
   }
 
   /**
-   * @expectedException \InvalidArgumentException
-   * @expectedExceptionMessage $string ("foo") must be a string.
    *
    * @covers ::__construct
    */
   public function testIsStringAssertionWithFormattableMarkup() {
     $translation = $this->getStringTranslationStub();
+    $this->setExpectedException('\InvalidArgumentException', '$string ("foo") must be a string.'); // ALGO COVER (body)
     $formattable_string = new FormattableMarkup('@bar', ['@bar' => 'foo']);
     new TranslatableMarkup($formattable_string);
   }
diff --git a/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php b/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php
index 7a3dd3a..bb0d8ba 100644
--- a/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php
+++ b/core/tests/Drupal/Tests/Core/Template/TwigSandboxTest.php
@@ -45,10 +45,10 @@ class TwigSandboxTest extends UnitTestCase {
    * Tests that dangerous methods cannot be called in entity objects.
    *
    * @dataProvider getTwigEntityDangerousMethods
-   * @expectedException \Twig_Sandbox_SecurityError
    */
   public function testEntityDangerousMethods($template) {
     $entity = $this->getMock('Drupal\Core\Entity\EntityInterface');
+    $this->setExpectedException('\Twig_Sandbox_SecurityError'); // ALGO LAST
     $this->twig->render($template, ['entity' => $entity]);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php b/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php
index 5e3558e..a72cd60 100644
--- a/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php
+++ b/core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php
@@ -95,10 +95,9 @@ class RecursiveContextualValidatorTest extends UnitTestCase {
    * Ensures that passing an explicit group is not supported.
    *
    * @covers ::validate
-   *
-   * @expectedException \LogicException
    */
   public function testValidateWithGroups() {
+    $this->setExpectedException('\LogicException'); // ALGO COVER (method)
     $this->recursiveValidator->validate('test', NULL, 'test group');
   }
 
@@ -106,10 +105,9 @@ class RecursiveContextualValidatorTest extends UnitTestCase {
    * Ensures that passing a non typed data value is not supported.
    *
    * @covers ::validate
-   *
-   * @expectedException \InvalidArgumentException
    */
   public function testValidateWithoutTypedData() {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (method)
     $this->recursiveValidator->validate('test');
   }
 
@@ -228,8 +226,6 @@ class RecursiveContextualValidatorTest extends UnitTestCase {
 
   /**
    * @covers ::validateProperty
-   *
-   * @expectedException \LogicException
    */
   public function testValidatePropertyWithCustomGroup() {
     $tree = [
@@ -239,6 +235,7 @@ class RecursiveContextualValidatorTest extends UnitTestCase {
       ],
     ];
     $typed_data = $this->setupTypedData($tree, 'test_name');
+    $this->setExpectedException('\LogicException'); // ALGO COVER (method)
     $this->recursiveValidator->validateProperty($typed_data, 'key1', 'test group');
   }
 
@@ -246,10 +243,9 @@ class RecursiveContextualValidatorTest extends UnitTestCase {
    * @covers ::validateProperty
    *
    * @dataProvider providerTestValidatePropertyWithInvalidObjects
-   *
-   * @expectedException \InvalidArgumentException
    */
   public function testValidatePropertyWithInvalidObjects($object) {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (method)
     $this->recursiveValidator->validateProperty($object, 'key1', NULL);
   }
 
@@ -289,10 +285,9 @@ class RecursiveContextualValidatorTest extends UnitTestCase {
    * @covers ::validatePropertyValue
    *
    * @dataProvider providerTestValidatePropertyWithInvalidObjects
-   *
-   * @expectedException \InvalidArgumentException
    */
   public function testValidatePropertyValueWithInvalidObjects($object) {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (method)
     $this->recursiveValidator->validatePropertyValue($object, 'key1', [], NULL);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php b/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php
index ef6dd25..12e27a4 100644
--- a/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php
+++ b/core/tests/Drupal/Tests/Core/UnroutedUrlTest.php
@@ -102,9 +102,9 @@ class UnroutedUrlTest extends UnitTestCase {
    *
    * @covers ::fromUri
    * @dataProvider providerFromInvalidUri
-   * @expectedException \InvalidArgumentException
    */
   public function testFromInvalidUri($uri) {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (body)
     $url = Url::fromUri($uri);
   }
 
@@ -133,8 +133,6 @@ class UnroutedUrlTest extends UnitTestCase {
    * Tests the createFromRequest method.
    *
    * @covers ::createFromRequest
-   *
-   * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
    */
   public function testCreateFromRequest() {
     $request = Request::create('/test-path');
@@ -144,6 +142,7 @@ class UnroutedUrlTest extends UnitTestCase {
       ->with($request)
       ->will($this->throwException(new ResourceNotFoundException()));
 
+    $this->setExpectedException('\Symfony\Component\Routing\Exception\ResourceNotFoundException'); // ALGO COVER (body)
     $this->assertNull(Url::createFromRequest($request));
   }
 
@@ -179,12 +178,11 @@ class UnroutedUrlTest extends UnitTestCase {
    * @depends testFromUri
    * @dataProvider providerFromUri
    *
-   * @expectedException \UnexpectedValueException
-   *
    * @covers ::getRouteName
    */
   public function testGetRouteName($uri) {
     $url = Url::fromUri($uri);
+    $this->setExpectedException('\UnexpectedValueException'); // ALGO COVER (method)
     $url->getRouteName();
   }
 
@@ -194,12 +192,11 @@ class UnroutedUrlTest extends UnitTestCase {
    * @depends testFromUri
    * @dataProvider providerFromUri
    *
-   * @expectedException \UnexpectedValueException
-   *
    * @covers ::getRouteParameters
    */
   public function testGetRouteParameters($uri) {
     $url = Url::fromUri($uri);
+    $this->setExpectedException('\UnexpectedValueException'); // ALGO COVER (method)
     $url->getRouteParameters();
   }
 
@@ -210,11 +207,10 @@ class UnroutedUrlTest extends UnitTestCase {
    * @dataProvider providerFromUri
    *
    * @covers ::getInternalPath
-   *
-   * @expectedException \Exception
    */
   public function testGetInternalPath($uri) {
     $url = Url::fromUri($uri);
+    $this->setExpectedException('\Exception'); // ALGO COVER (body)
     $this->assertNull($url->getInternalPath());
   }
 
diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php
index 5324c26..92785f4 100644
--- a/core/tests/Drupal/Tests/Core/UrlTest.php
+++ b/core/tests/Drupal/Tests/Core/UrlTest.php
@@ -215,10 +215,10 @@ class UrlTest extends UnitTestCase {
    * Tests the fromUserInput method with invalid paths.
    *
    * @covers ::fromUserInput
-   * @expectedException \InvalidArgumentException
    * @dataProvider providerFromInvalidInternalUri
    */
   public function testFromInvalidUserInput($path) {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (body)
     $url = Url::fromUserInput($path);
   }
 
@@ -280,8 +280,6 @@ class UrlTest extends UnitTestCase {
    * Tests that an invalid request will thrown an exception.
    *
    * @covers ::createFromRequest
-   *
-   * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
    */
   public function testUrlFromRequestInvalid() {
     $request = Request::create('/test-path');
@@ -291,6 +289,7 @@ class UrlTest extends UnitTestCase {
       ->with($request)
       ->will($this->throwException(new ResourceNotFoundException()));
 
+    $this->setExpectedException('\Symfony\Component\Routing\Exception\ResourceNotFoundException'); // ALGO COVER (body)
     $this->assertNull(Url::createFromRequest($request));
   }
 
@@ -315,13 +314,12 @@ class UrlTest extends UnitTestCase {
    *
    * @depends testUrlFromRequest
    *
-   * @expectedException \UnexpectedValueException
-   *
    * @covers ::getUri
    */
   public function testGetUriForInternalUrl($urls) {
     foreach ($urls as $url) {
-      $url->getUri();
+      $this->setExpectedException('\UnexpectedValueException'); // ALGO COVER (method)
+    $url->getUri();
     }
   }
 
@@ -418,10 +416,10 @@ class UrlTest extends UnitTestCase {
    * Tests the getRouteName() with an external URL.
    *
    * @covers ::getRouteName
-   * @expectedException \UnexpectedValueException
    */
   public function testGetRouteNameWithExternalUrl() {
     $url = Url::fromUri('http://example.com');
+    $this->setExpectedException('\UnexpectedValueException'); // ALGO COVER (method)
     $url->getRouteName();
   }
 
@@ -445,10 +443,10 @@ class UrlTest extends UnitTestCase {
    * Tests the getRouteParameters() with an external URL.
    *
    * @covers ::getRouteParameters
-   * @expectedException \UnexpectedValueException
    */
   public function testGetRouteParametersWithExternalUrl() {
     $url = Url::fromUri('http://example.com');
+    $this->setExpectedException('\UnexpectedValueException'); // ALGO COVER (method)
     $url->getRouteParameters();
   }
 
@@ -605,7 +603,6 @@ class UrlTest extends UnitTestCase {
    * Tests the fromUri() method with an invalid entity: URI.
    *
    * @covers ::fromUri
-   * @expectedException \Symfony\Component\Routing\Exception\InvalidParameterException
    */
   public function testInvalidEntityUriParameter() {
     // Make the mocked URL generator behave like the actual one.
@@ -614,6 +611,7 @@ class UrlTest extends UnitTestCase {
       ->with('entity.test_entity.canonical', ['test_entity' => '1/blah'])
       ->willThrowException(new InvalidParameterException('Parameter "test_entity" for route "/test_entity/{test_entity}" must match "[^/]++" ("1/blah" given) to generate a corresponding URL..'));
 
+    $this->setExpectedException('\Symfony\Component\Routing\Exception\InvalidParameterException'); // ALGO COVER (body)
     Url::fromUri('entity:test_entity/1/blah')->toString();
   }
 
@@ -728,10 +726,10 @@ class UrlTest extends UnitTestCase {
    * Tests the fromUri() method with an invalid internal: URI.
    *
    * @covers ::fromUri
-   * @expectedException \InvalidArgumentException
    * @dataProvider providerFromInvalidInternalUri
    */
   public function testFromInvalidInternalUri($path) {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (method)
     Url::fromUri('internal:' . $path);
   }
 
@@ -800,10 +798,9 @@ class UrlTest extends UnitTestCase {
   }
 
   /**
-   * @expectedException \InvalidArgumentException
-   * @expectedExceptionMessage The route URI 'route:' is invalid.
    */
   public function testFromRouteUriWithMissingRouteName() {
+    $this->setExpectedException('\InvalidArgumentException', "The route URI 'route:' is invalid."); // ALGO ONE
     Url::fromUri('route:');
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
index b2d7700..2095297 100644
--- a/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
+++ b/core/tests/Drupal/Tests/Core/Utility/UnroutedUrlAssemblerTest.php
@@ -56,17 +56,17 @@ class UnroutedUrlAssemblerTest extends UnitTestCase {
 
   /**
    * @covers ::assemble
-   * @expectedException \InvalidArgumentException
    */
   public function testAssembleWithNeitherExternalNorDomainLocalUri() {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (method)
     $this->unroutedUrlAssembler->assemble('wrong-url');
   }
 
   /**
    * @covers ::assemble
-   * @expectedException \InvalidArgumentException
    */
   public function testAssembleWithLeadingSlash() {
+    $this->setExpectedException('\InvalidArgumentException'); // ALGO COVER (method)
     $this->unroutedUrlAssembler->assemble('/drupal.org');
   }
 
