/**
  * @expectedException Mage_Core_Exception
  */
 public function testConfirmPaymentWithException()
 {
     $configMock = $this->getConfigMockWithOrderId();
     $fakeOrder = $this->getFakeOrder();
     $payment = $this->getFakePayment($fakeOrder);
     $fakeQuote = $this->getFakeQuote();
     $quoteHelperMock = $this->getQuoteHelperMock($fakeQuote);
     $testMock = $this->getModelMock('ops/payment_directDebit', array('handleAdminPayment', 'performPreDirectLinkCallActions', 'performPostDirectLinkCallActions', 'getOnepage'));
     $dataHelperMock = $this->getHelperMock('ops/data', array('isAdminSession'));
     $dataHelperMock->expects($this->once())->method('isAdminSession')->will($this->returnValue(true));
     $testMock->setDataHelper($dataHelperMock);
     $fakeOnepage = new Varien_Object();
     $fakeOnepage->setCheckout(new Varien_Object());
     $testMock->expects($this->once())->method('getOnepage')->will($this->returnValue($fakeOnepage));
     $requestParams = array('ORDERID' => '123');
     $requestParamsHelperMock = $this->getHelperMock('ops/directDebit', array('getDirectLinkRequestParams'));
     $requestParamsHelperMock->expects($this->once())->method('getDirectLinkRequestParams')->with($fakeQuote, $fakeOrder, $payment)->will($this->returnValue($requestParams));
     $testMock->setRequestParamsHelper($requestParamsHelperMock);
     $fakeValidator = $this->getModelMock('ops/validator_parameter_length', array('isValid'));
     $fakeValidator->expects($this->once())->method('isValid')->will($this->returnValue(false));
     $validationMock = $this->getModelMock('ops/validator_parameter_factory', array('getValidatorFor'));
     $validationMock->expects($this->once())->method('getValidatorFor')->will($this->returnValue($fakeValidator));
     $testMock->setValidationFactory($validationMock);
     $testMock->setQuoteHelper($quoteHelperMock);
     $testMock->setConfig($configMock);
     $testMock->authorize($payment, 100);
 }