diff --git a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartTotalRepositoryTest.php b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartTotalRepositoryTest.php
index 4d39e8edeea32461e5099fd01ea794823a5a6fe2..4db02b5caf14eb69d8268b27407d5cd002cff56f 100644
--- a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartTotalRepositoryTest.php
+++ b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartTotalRepositoryTest.php
@@ -57,6 +57,15 @@ class GuestCartTotalRepositoryTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()
             ->getMock();
 
+        $this->maskedCartId = 'f216207248d65c789b17be8545e0aa73';
+        $this->cartId = 123;
+
+        $guestCartTestHelper = new GuestCartTestHelper($this);
+        list($this->quoteIdMaskFactoryMock, $this->quoteIdMaskMock) = $guestCartTestHelper->mockQuoteIdMask(
+            $this->maskedCartId,
+            $this->cartId
+        );
+
         $this->model = $this->objectManager->getObject(
             'Magento\Quote\Model\GuestCart\GuestCartTotalRepository',
             [
@@ -64,17 +73,6 @@ class GuestCartTotalRepositoryTest extends \PHPUnit_Framework_TestCase
                 'quoteIdMaskFactory' => $this->quoteIdMaskFactoryMock,
             ]
         );
-
-        $this->quoteIdMaskFactoryMock->expects($this->once())
-            ->method('create')
-            ->willReturn($this->quoteIdMaskMock);
-        $this->quoteIdMaskMock->expects($this->once())
-            ->method('load')
-            ->with($this->maskedCartId, 'masked_id')
-            ->willReturn($this->quoteIdMaskMock);
-        $this->quoteIdMaskMock->expects($this->once())
-            ->method('getId')
-            ->willReturn($this->cartId);
     }
 
     public function testGetTotals()
diff --git a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestShippingMethodManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestShippingMethodManagementTest.php
index 07a83b5e281e6e833f6f01a1f56a9a8987a7481a..c91510a165fac2c1ecbacf3400cfba4b6f6d5be1 100644
--- a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestShippingMethodManagementTest.php
+++ b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestShippingMethodManagementTest.php
@@ -46,12 +46,16 @@ class GuestShippingMethodManagementTest extends \PHPUnit_Framework_TestCase
         $this->shippingMethodManagementMock =
             $this->getMockBuilder('Magento\Quote\Api\ShippingMethodManagementInterface')
             ->getMockForAbstractClass();
-        $this->quoteIdMaskFactoryMock = $this->getMockBuilder('Magento\Quote\Model\QuoteIdMaskFactory')
-            ->disableOriginalConstructor()
-            ->getMock();
-        $this->quoteIdMaskMock = $this->getMockBuilder('Magento\Quote\Model\QuoteIdMask')
-            ->disableOriginalConstructor()
-            ->getMock();
+
+        $this->maskedCartId = 'f216207248d65c789b17be8545e0aa73';
+        $this->cartId = 867;
+
+        $guestCartTestHelper = new GuestCartTestHelper($this);
+        list($this->quoteIdMaskFactoryMock, $this->quoteIdMaskMock) = $guestCartTestHelper->mockQuoteIdMask(
+            $this->maskedCartId,
+            $this->cartId
+        );
+
         $this->model = $objectManager->getObject(
             'Magento\Quote\Model\GuestCart\GuestShippingMethodManagement',
             [
@@ -59,20 +63,6 @@ class GuestShippingMethodManagementTest extends \PHPUnit_Framework_TestCase
                 'quoteIdMaskFactory' => $this->quoteIdMaskFactoryMock,
             ]
         );
-
-        $this->maskedCartId = 'f216207248d65c789b17be8545e0aa73';
-        $this->cartId = 867;
-
-        $this->quoteIdMaskFactoryMock->expects($this->once())
-            ->method('create')
-            ->willReturn($this->quoteIdMaskMock);
-        $this->quoteIdMaskMock->expects($this->once())
-            ->method('load')
-            ->with($this->maskedCartId, 'masked_id')
-            ->willReturn($this->quoteIdMaskMock);
-        $this->quoteIdMaskMock->expects($this->once())
-            ->method('getId')
-            ->willReturn($this->cartId);
     }
 
     public function testSet()