diff --git a/src/Tests/Entity/PaymentUnitTest.php b/src/Tests/Entity/PaymentUnitTest.php
deleted file mode 100644
index fb989d3..0000000
--- a/src/Tests/Entity/PaymentUnitTest.php
+++ /dev/null
@@ -1,210 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\payment\Tests\Entity\PaymentUnitTest.
- */
-
-namespace Drupal\payment\Tests\Entity;
-
-use Drupal\payment\Entity\PaymentInterface;
-use Drupal\payment\Payment;
-use Drupal\payment\Plugin\Payment\Type\PaymentTypeInterface;
-use Drupal\simpletest\KernelTestBase;
-
-/**
- * \Drupal\payment\Entity\Payment unit test.
- *
- * @group Payment
- */
-class PaymentUnitTest extends KernelTestBase {
-
-  /**
-   * The payment bundle to test with used for testing.
-   *
-   * @var string
-   */
-  protected $bundle = 'payment_unavailable';
-
-  /**
-   * The payment line item manager used for testing.
-   *
-   * @var \Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemManagerInterface
-   */
-  protected $lineItemManager;
-
-  /**
-   * {@inheritdoc}
-   */
-  public static $modules = array('currency', 'field', 'payment', 'payment_test', 'plugin', 'system', 'user');
-
-  /**
-   * The payment under test.
-   *
-   * @var \Drupal\payment\Entity\Payment
-   */
-  protected $payment;
-
-  /**
-   * The payment status manager used for testing.
-   *
-   * @var \Drupal\payment\Plugin\Payment\Status\PaymentStatusManagerInterface
-   */
-  protected $statusManager;
-
-  /**
-   * {@inheritdoc
-   */
-  protected function setUp() {
-    parent::setUp();
-    $this->bundle = 'payment_unavailable';
-    $this->lineItemManager = Payment::lineItemManager();
-    $this->statusManager = Payment::statusManager();
-    $this->payment = entity_create('payment', array(
-      'bundle' => $this->bundle,
-    ));
-  }
-
-  /**
-   * Tests label().
-   */
-  protected function testLabel() {
-    $this->assertIdentical($this->payment->label(), 'Unavailable');
-  }
-
-  /**
-   * Tests bundle().
-   */
-  protected function testBundle() {
-    $this->assertIdentical($this->payment->bundle(), $this->bundle);
-  }
-
-  /**
-   * Tests getPaymentType().
-   */
-  protected function testGetPaymentType() {
-    if ($this->assertTrue($this->payment->getPaymentType() instanceof PaymentTypeInterface)) {
-      $this->assertIdentical($this->payment->getPaymentType()->getPluginId(), $this->bundle);
-    }
-  }
-
-  /**
-   * Tests setCurrencyCode() and getCurrencyCode().
-   */
-  protected function testGetCurrencyCode() {
-    $currency_code = 'ABC';
-    $this->assertTrue($this->payment->setCurrencyCode($currency_code) instanceof PaymentInterface);
-    $this->assertIdentical($this->payment->getCurrencyCode(), $currency_code);
-  }
-
-  /**
-   * Tests setLineItem() and getLineItem().
-   */
-  protected function testGetLineItem() {
-    $line_item = $this->lineItemManager->createInstance('payment_basic');
-    $line_item->setName($this->randomMachineName());
-    $this->assertTrue($this->payment->setLineItem($line_item) instanceof PaymentInterface);
-    $this->assertIdentical(spl_object_hash($this->payment->getLineItem($line_item->getName())), spl_object_hash($line_item));
-  }
-
-  /**
-   * Tests unsetLineItem().
-   */
-  protected function testUnsetLineItem() {
-    $line_item = $this->lineItemManager->createInstance('payment_basic');
-    $name = $this->randomMachineName();
-    $line_item->setName($name);
-    $this->payment->setLineItem($line_item);
-    $this->assertEqual(spl_object_hash($this->payment), spl_object_hash($this->payment->unsetLineItem($name)));
-    $this->assertNull($this->payment->getLineItem($name));
-  }
-
-  /**
-   * Tests setLineItems() and getLineItems().
-   */
-  protected function testGetLineItems() {
-    $line_item_1 = $this->lineItemManager->createInstance('payment_basic');
-    $line_item_1->setName($this->randomMachineName());
-    $line_item_2 = $this->lineItemManager->createInstance('payment_basic');
-    $line_item_2->setName($this->randomMachineName());
-    $this->assertTrue(spl_object_hash($this->payment->setLineItems([$line_item_1, $line_item_2])), spl_object_hash($this->payment));
-    $line_items = $this->payment->getLineItems();
-    if ($this->assertTrue(is_array($line_items))) {
-      $this->assertEqual(spl_object_hash($line_items[$line_item_1->getName()]), spl_object_hash($line_item_1));
-      $this->assertEqual(spl_object_hash($line_items[$line_item_2->getName()]), spl_object_hash($line_item_2));
-    }
-  }
-
-  /**
-   * Tests getLineItemsByType().
-   */
-  protected function testGetLineItemsByType() {
-    $type = 'payment_basic';
-    $line_item = $this->lineItemManager->createInstance($type);
-    $this->assertEqual(spl_object_hash($this->payment->setLineItem($line_item)), spl_object_hash($this->payment));
-    $line_items = $this->payment->getLineItemsByType($type);
-    $this->assertEqual(spl_object_hash(reset($line_items)), spl_object_hash($line_item));
-  }
-
-  /**
-   * Tests setPaymentStatus() and getPaymentStatus().
-   */
-  protected function testGetPaymentStatus() {
-    $payment_status_a = $this->statusManager->createInstance('payment_pending');
-    $payment_status_b = $this->statusManager->createInstance('payment_failed');
-    $this->assertEqual(spl_object_hash($this->payment->setPaymentStatus($payment_status_a)), spl_object_hash($this->payment));
-    $this->assertEqual(spl_object_hash($this->payment->getPaymentStatus()), spl_object_hash($payment_status_a));
-    // Make sure we always get the last status.
-    $this->payment->setPaymentStatus($payment_status_b);
-    $this->assertEqual(spl_object_hash($this->payment->getPaymentStatus()), spl_object_hash($payment_status_b));
-  }
-
-  /**
-   * Tests setPaymentStatuses() and getPaymentStatuses().
-   */
-  protected function testGetPaymentStatuses() {
-    $statuses = array($this->statusManager->createInstance('payment_pending'), $this->statusManager->createInstance('payment_failed'));
-    $this->assertEqual(spl_object_hash($this->payment->setPaymentStatuses($statuses)), spl_object_hash($this->payment));
-    $retrieved_statuses = $this->payment->getPaymentStatuses();
-    $this->assertEqual(spl_object_hash(reset($retrieved_statuses)), spl_object_hash(reset($statuses)));
-    $this->assertEqual(spl_object_hash(end($retrieved_statuses)), spl_object_hash(end($statuses)));
-    // Make sure we always get the last status.
-    $this->assertEqual(spl_object_hash($this->payment->getPaymentStatus()), spl_object_hash(end($statuses)));
-  }
-
-  /**
-   * Tests getPaymentMethod().
-   */
-  protected function testGetPaymentMethod() {
-    $payment_method = Payment::methodManager()->createInstance('payment_basic');
-    $this->payment->setPaymentMethod($payment_method);
-    $this->assertTrue(spl_object_hash($this->payment->getPaymentMethod()), spl_object_hash($this->payment));
-  }
-
-  /**
-   * Tests setOwnerId() and getOwnerId().
-   */
-  protected function testGetOwnerId() {
-    $id = 5;
-    $this->assertTrue($this->payment->setOwnerId($id) instanceof PaymentInterface);
-    $this->assertIdentical($this->payment->getOwnerId(), $id);
-  }
-
-  /**
-   * Tests getAmount().
-   */
-  protected function testGetAmount() {
-    $amount = 3;
-    $quantity = 2;
-    for ($i = 0; $i < 2; $i++) {
-      /** @var \Drupal\payment\Plugin\Payment\LineItem\Basic $line_item */
-      $line_item = $this->lineItemManager->createInstance('payment_basic');
-      $name = $this->randomMachineName();
-      $line_item->setName($name);
-      $line_item->setAmount($amount);
-      $line_item->setQuantity($quantity);
-      $this->payment->setLineItem($line_item);
-    }
-    $this->assertEqual($this->payment->getAmount(), 12);
-  }
-}
diff --git a/tests/src/Kernel/Entity/PaymentTest.php b/tests/src/Kernel/Entity/PaymentTest.php
new file mode 100644
index 0000000..b28db92
--- /dev/null
+++ b/tests/src/Kernel/Entity/PaymentTest.php
@@ -0,0 +1,236 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\payment\Tests\Entity\PaymentUnitTest.
+ */
+
+namespace Drupal\Tests\payment\Kernel\Entity;
+
+use Drupal\Component\FileCache\FileCacheFactory;
+use Drupal\KernelTests\KernelTestBase;
+use Drupal\payment\Entity\PaymentInterface;
+use Drupal\payment\Payment;
+use Drupal\payment\Plugin\Payment\LineItem\PaymentLineItemInterface;
+use Drupal\payment\Plugin\Payment\Method\PaymentMethodInterface;
+use Drupal\payment\Plugin\Payment\Status\PaymentStatusInterface;
+use Drupal\payment\Plugin\Payment\Type\PaymentTypeInterface;
+
+/**
+ * @coversDefaultClass \Drupal\payment\Entity\Payment
+ *
+ * @group Payment
+ */
+class PaymentTest extends KernelTestBase {
+
+  /**
+   * The payment bundle.
+   *
+   * @var string
+   */
+  protected $bundle = 'payment_unavailable';
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = array('currency', 'field', 'payment', 'payment_test', 'plugin', 'system', 'user');
+
+  /**
+   * The subject under test.
+   *
+   * @var \Drupal\payment\Entity\Payment
+   */
+  protected $sut;
+
+  /**
+   * {@inheritdoc
+   */
+  public function setUp() {
+    FileCacheFactory::setPrefix($this->randomMachineName());
+    parent::setUp();
+    $this->bundle = 'payment_unavailable';
+    $this->sut = entity_create('payment', array(
+      'bundle' => $this->bundle,
+    ));
+  }
+
+  /**
+   * @covers ::label
+   */
+  public function testLabel() {
+    $this->assertSame('Unavailable', $this->sut->label());
+  }
+
+  /**
+   * @covers ::bundle
+   */
+  public function testBundle() {
+    $this->assertSame($this->bundle, $this->sut->bundle());
+  }
+
+  /**
+   * @covers ::getPaymentType
+   */
+  public function testGetPaymentType() {
+    $this->assertInstanceOf(PaymentTypeInterface::class, $this->sut->getPaymentType());
+    $this->assertSame($this->bundle, $this->sut->getPaymentType()->getPluginId());
+  }
+
+  /**
+   * @covers ::getCurrencyCode
+   * @covers ::setCurrencyCode
+   */
+  public function testGetCurrencyCode() {
+    $currency_code = 'ABC';
+    $this->assertSame($this->sut, $this->sut->setCurrencyCode($currency_code));
+    $this->assertSame($currency_code, $this->sut->getCurrencyCode());
+  }
+
+  /**
+   * @covers ::getLineItem
+   * @covers ::setLineItem
+   */
+  public function testGetLineItem() {
+    $line_item_name = $this->randomMachineName();
+    $line_item = $this->getMock(PaymentLineItemInterface::class);
+    $line_item->expects($this->atLeastOnce())
+      ->method('getName')
+      ->willReturn($line_item_name);
+
+    $this->assertSame($this->sut, $this->sut->setLineItem($line_item));
+    $this->assertSame($line_item, $this->sut->getLineItem($line_item_name));
+  }
+
+  /**
+   * @covers ::unsetLineItem
+   *
+   * @depends testGetLineItem
+   */
+  public function testUnsetLineItem() {
+    $line_item_name = $this->randomMachineName();
+    $line_item = $this->getMock(PaymentLineItemInterface::class);
+    $line_item->expects($this->atLeastOnce())
+      ->method('getName')
+      ->willReturn($line_item_name);
+
+    $this->sut->setLineItem($line_item);
+    $this->assertSame($this->sut, $this->sut->unsetLineItem($line_item_name));
+    $this->assertNull($this->sut->getLineItem($line_item_name));
+  }
+
+  /**
+   * @covers ::getLineItems
+   * @covers ::setLineItems
+   */
+  public function testGetLineItems() {
+    $line_item_name_a = $this->randomMachineName();
+    $line_item_a = $this->getMock(PaymentLineItemInterface::class);
+    $line_item_a->expects($this->atLeastOnce())
+      ->method('getName')
+      ->willReturn($line_item_name_a);
+    $line_item_name_b = $this->randomMachineName();
+    $line_item_b = $this->getMock(PaymentLineItemInterface::class);
+    $line_item_b->expects($this->atLeastOnce())
+      ->method('getName')
+      ->willReturn($line_item_name_b);
+
+    $this->assertSame($this->sut, $this->sut->setLineItems([$line_item_a, $line_item_b]));
+    $line_items = $this->sut->getLineItems();
+    $this->assertInternalType('array', $line_items);
+    $this->assertSame($line_item_a, $line_items[$line_item_name_a]);
+    $this->assertSame($line_item_b, $line_items[$line_item_name_b]);
+  }
+
+  /**
+   * @covers ::getLineItemsByType
+   */
+  public function testGetLineItemsByType() {
+    $line_item_plugin_id = $this->randomMachineName();
+    $line_item = $this->getMock(PaymentLineItemInterface::class);
+    $line_item->expects($this->atLeastOnce())
+      ->method('getPluginId')
+      ->willReturn($line_item_plugin_id);
+
+    $this->assertSame($this->sut, $this->sut->setLineItem($line_item));
+    $line_items = $this->sut->getLineItemsByType($line_item_plugin_id);
+    $this->assertSame($line_item, reset($line_items));
+  }
+
+  /**
+   * @covers ::getPaymentStatus
+   * @covers ::setPaymentStatus
+   */
+  public function testGetPaymentStatus() {
+    $payment_status_id_a = $this->randomMachineName();
+    $payment_status_a = $this->getMock(PaymentStatusInterface::class);
+    $payment_status_a->expects($this->atLeastOnce())
+      ->method('getPluginId')
+      ->willReturn($payment_status_id_a);
+    $payment_status_id_b = $this->randomMachineName();
+    $payment_status_b = $this->getMock(PaymentStatusInterface::class);
+    $payment_status_a->expects($this->atLeastOnce())
+      ->method('getPluginId')
+      ->willReturn($payment_status_id_b);
+    $this->assertSame($this->sut, $this->sut->setPaymentStatus($payment_status_a));
+    $this->assertSame($payment_status_a, $this->sut->getPaymentStatus());
+    // Make sure we always get the last status.
+    $this->sut->setPaymentStatus($payment_status_b);
+    $this->assertSame($payment_status_b, $this->sut->getPaymentStatus());
+  }
+
+  /**
+   * @covers ::getPaymentStatuses
+   * @covers ::setPaymentStatuses
+   * @covers ::getPaymentStatus
+   */
+  public function testGetPaymentStatuses() {
+    $payment_status_a = $this->getMock(PaymentStatusInterface::class);
+    $payment_status_b = $this->getMock(PaymentStatusInterface::class);
+    $payment_statuses = [$payment_status_a, $payment_status_b];
+    $this->assertSame($this->sut, $this->sut->setPaymentStatuses($payment_statuses));
+    $this->assertSame($payment_statuses, $this->sut->getPaymentStatuses());
+    // Make sure we always get the last status.
+    $this->assertSame($payment_status_b, $this->sut->getPaymentStatus());
+  }
+
+  /**
+   * @covers ::getPaymentMethod
+   * @covers ::setPaymentMethod
+   */
+  public function testGetPaymentMethod() {
+    $payment_method = $this->getMock(PaymentMethodInterface::class);
+    $this->assertSame($this->sut, $this->sut->setPaymentMethod($payment_method));
+    $this->assertSame($payment_method, $this->sut->getPaymentMethod());
+  }
+
+  /**
+   * @covers ::getOwnerId
+   * @covers ::setOwnerId
+   */
+  public function testGetOwnerId() {
+    $id = mt_rand();
+    $this->assertSame($this->sut, $this->sut->setOwnerId($id));
+    $this->assertSame($id, $this->sut->getOwnerId());
+  }
+
+  /**
+   * @covers ::getAmount
+   */
+  public function testGetAmount() {
+    $line_item_total_amount = 6;
+    $payment_amount = 12;
+    for ($i = 0; $i < 2; $i++) {
+      $line_item_name = $this->randomMachineName();
+      $line_item = $this->getMock(PaymentLineItemInterface::class);
+      $line_item->expects($this->atLeastOnce())
+        ->method('getName')
+        ->willReturn($line_item_name);
+      $line_item->expects($this->atLeastOnce())
+        ->method('getTotalAmount')
+        ->willReturn($line_item_total_amount);
+      $this->sut->setLineItem($line_item);
+    }
+    $this->assertEqual($this->sut->getAmount(), $payment_amount);
+  }
+
+}
