/**
  * @expectedException \Magento\Framework\Exception\State\InvalidTransitionException
  */
 public function testSaveWithException()
 {
     $taxClass = $this->getMockForAbstractClass('Magento\\Tax\\Api\\Data\\TaxClassInterface', [], '', false);
     $this->groupFactory->expects($this->once())->method('create')->willReturn($this->groupModel);
     $this->group->expects($this->atLeastOnce())->method('getCode')->willReturn('Code');
     $this->group->expects($this->atLeastOnce())->method('getId')->willReturn(false);
     $this->group->expects($this->atLeastOnce())->method('getTaxClassId')->willReturn(234);
     $this->group->expects($this->atLeastOnce())->method('getTaxClassId')->willReturn(17);
     $this->groupModel->expects($this->once())->method('setCode')->with('Code');
     $this->groupModel->expects($this->once())->method('setTaxClassId')->with(234);
     $this->taxClassRepository->expects($this->once())->method('get')->with(234)->willReturn($taxClass);
     $taxClass->expects($this->once())->method('getClassType')->willReturn('CUSTOMER');
     $this->groupResourceModel->expects($this->once())->method('save')->with($this->groupModel)->willThrowException(new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase('Customer Group already exists.')));
     $this->model->save($this->group);
 }