@Ignore @Test(expected = CantSendCryptoException.class) public void testSend_InsufficientFundsException() throws Exception { doReturn(transactionManager).when(outgoingExtraUserManager).getTransactionManager(); doThrow( new InsufficientFundsException( InsufficientFundsException.DEFAULT_MESSAGE, null, null, null)) .when(transactionManager) .send( anyString(), any(CryptoAddress.class), anyLong(), anyString(), anyString(), any(Actors.class), anyString(), any(Actors.class)); walletModuleCryptoWallet.send( cryptoAmount, destinationAddress, notes, walletPublicKey, deliveredByActorId, deliveredByActorType, deliveredToActorId, deliveredToActorType); }
@Before public void setUp() throws Exception { cryptoAmount = 1; destinationAddress = new CryptoAddress("asdasd", CryptoCurrency.BITCOIN); walletPublicKey = AsymmectricCryptography.derivePublicKey(AsymmectricCryptography.createPrivateKey()); notes = "NOTE"; deliveredByActorId = new ECCKeyPair().getPublicKey(); deliveredByActorType = Actors.EXTRA_USER; deliveredToActorId = new ECCKeyPair().getPublicKey(); deliveredToActorType = Actors.INTRA_USER; walletModuleCryptoWallet = new CryptoWalletWalletModuleManager(); walletModuleCryptoWallet.setErrorManager(errorManager); walletModuleCryptoWallet.setCryptoAddressBookManager(cryptoAddressBookManager); walletModuleCryptoWallet.setWalletContactsManager(walletContactsManager); walletModuleCryptoWallet.setOutgoingExtraUserManager(outgoingExtraUserManager); walletModuleCryptoWallet.initialize(); }
@Test public void testSend_Success() throws Exception { doReturn(transactionManager).when(outgoingExtraUserManager).getTransactionManager(); walletModuleCryptoWallet.send( cryptoAmount, destinationAddress, notes, walletPublicKey, deliveredByActorId, deliveredByActorType, deliveredToActorId, deliveredToActorType); }
@Test(expected = CantSendCryptoException.class) public void testSend_CantGetTransactionManagerException() throws Exception { doThrow( new CantGetTransactionManagerException( CantGetTransactionManagerException.DEFAULT_MESSAGE, null, null, null)) .when(outgoingExtraUserManager) .getTransactionManager(); walletModuleCryptoWallet.send( cryptoAmount, destinationAddress, notes, walletPublicKey, deliveredByActorId, deliveredByActorType, deliveredToActorId, deliveredToActorType); }