public function testDeleteById()
 {
     $id = 1;
     $entity = $this->getMockBuilder('Magento\\Sales\\Model\\Order\\Invoice')->disableOriginalConstructor()->getMock();
     $entity->expects($this->once())->method('load')->with($id)->willReturn($entity);
     $entity->expects($this->any())->method('getEntityId')->willReturn($id);
     $this->invoiceMetadata->expects($this->once())->method('getNewInstance')->willReturn($entity);
     $mapper = $this->getMockBuilder('Magento\\Sales\\Model\\ResourceModel\\Order\\Invoice')->disableOriginalConstructor()->getMock();
     $mapper->expects($this->once())->method('delete')->with($entity);
     $this->invoiceMetadata->expects($this->any())->method('getMapper')->willReturn($mapper);
     $this->assertTrue($this->invoice->deleteById($id));
 }