Adjust tests to new params

This commit is contained in:
chimp1984 2019-11-15 00:03:52 -05:00
parent 50fc1393e0
commit 9092160700
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
4 changed files with 27 additions and 18 deletions

View File

@ -37,7 +37,7 @@ public class OpenOfferManagerTest {
when(p2PService.getPeerManager()).thenReturn(mock(PeerManager.class));
final OpenOfferManager manager = new OpenOfferManager(null, null, p2PService,
final OpenOfferManager manager = new OpenOfferManager(null, null, null, p2PService,
null, null, null, offerBookService,
null, null, null,
null, null, null, null, null,
@ -73,7 +73,7 @@ public class OpenOfferManagerTest {
when(p2PService.getPeerManager()).thenReturn(mock(PeerManager.class));
final OpenOfferManager manager = new OpenOfferManager(null, null, p2PService,
final OpenOfferManager manager = new OpenOfferManager(null, null, null, p2PService,
null, null, null, offerBookService,
null, null, null,
null, null, null, null, null,
@ -101,7 +101,7 @@ public class OpenOfferManagerTest {
when(p2PService.getPeerManager()).thenReturn(mock(PeerManager.class));
final OpenOfferManager manager = new OpenOfferManager(null, null, p2PService,
final OpenOfferManager manager = new OpenOfferManager(null, null, null, p2PService,
null, null, null, offerBookService,
null, null, null,
null, null, null, null, null,

View File

@ -2,13 +2,13 @@ package bisq.desktop.main.offer.createoffer;
import bisq.desktop.main.offer.MakerFeeProvider;
import bisq.core.btc.TxFeeEstimationService;
import bisq.core.btc.model.AddressEntry;
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.locale.CryptoCurrency;
import bisq.core.locale.FiatCurrency;
import bisq.core.locale.GlobalSettings;
import bisq.core.locale.Res;
import bisq.core.offer.CreateOfferService;
import bisq.core.offer.OfferPayload;
import bisq.core.payment.ClearXchangeAccount;
import bisq.core.payment.PaymentAccount;
@ -21,6 +21,7 @@ import bisq.core.user.User;
import org.bitcoinj.core.Coin;
import java.util.HashSet;
import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
@ -48,20 +49,20 @@ public class CreateOfferDataModelTest {
BtcWalletService btcWalletService = mock(BtcWalletService.class);
PriceFeedService priceFeedService = mock(PriceFeedService.class);
FeeService feeService = mock(FeeService.class);
TxFeeEstimationService feeEstimationService = mock(TxFeeEstimationService.class);
CreateOfferService createOfferService = mock(CreateOfferService.class);
preferences = mock(Preferences.class);
user = mock(User.class);
when(btcWalletService.getOrCreateAddressEntry(anyString(), any())).thenReturn(addressEntry);
when(preferences.isUsePercentageBasedPrice()).thenReturn(true);
when(preferences.getBuyerSecurityDepositAsPercent(null)).thenReturn(0.01);
when(createOfferService.getRandomOfferId()).thenReturn(UUID.randomUUID().toString());
makerFeeProvider = mock(MakerFeeProvider.class);
model = new CreateOfferDataModel(null, btcWalletService,
model = new CreateOfferDataModel(createOfferService, null, btcWalletService,
null, preferences, user, null,
null, priceFeedService, null,
null, feeService, feeEstimationService,
null, null, makerFeeProvider, null);
priceFeedService, null,
feeService, null, makerFeeProvider, null);
}
@Test

View File

@ -24,7 +24,6 @@ import bisq.desktop.util.validation.FiatPriceValidator;
import bisq.desktop.util.validation.SecurityDepositValidator;
import bisq.core.account.witness.AccountAgeWitnessService;
import bisq.core.btc.TxFeeEstimationService;
import bisq.core.btc.model.AddressEntry;
import bisq.core.btc.wallet.BsqWalletService;
import bisq.core.btc.wallet.BtcWalletService;
@ -32,6 +31,7 @@ import bisq.core.locale.Country;
import bisq.core.locale.CryptoCurrency;
import bisq.core.locale.GlobalSettings;
import bisq.core.locale.Res;
import bisq.core.offer.CreateOfferService;
import bisq.core.offer.OfferPayload;
import bisq.core.payment.PaymentAccount;
import bisq.core.provider.fee.FeeService;
@ -51,6 +51,8 @@ import javafx.collections.FXCollections;
import java.time.Instant;
import java.util.UUID;
import org.junit.Before;
import org.junit.Test;
@ -89,7 +91,7 @@ public class CreateOfferViewModelTest {
BsqWalletService bsqWalletService = mock(BsqWalletService.class);
SecurityDepositValidator securityDepositValidator = mock(SecurityDepositValidator.class);
AccountAgeWitnessService accountAgeWitnessService = mock(AccountAgeWitnessService.class);
TxFeeEstimationService txFeeEstimationService = mock(TxFeeEstimationService.class);
CreateOfferService createOfferService = mock(CreateOfferService.class);
when(btcWalletService.getOrCreateAddressEntry(anyString(), any())).thenReturn(addressEntry);
when(btcWalletService.getBalanceForAddress(any())).thenReturn(Coin.valueOf(1000L));
@ -103,11 +105,12 @@ public class CreateOfferViewModelTest {
when(preferences.getUserCountry()).thenReturn(new Country("ES", "Spain", null));
when(bsqFormatter.formatCoin(any())).thenReturn("0");
when(bsqWalletService.getAvailableConfirmedBalance()).thenReturn(Coin.ZERO);
when(createOfferService.getRandomOfferId()).thenReturn(UUID.randomUUID().toString());
CreateOfferDataModel dataModel = new CreateOfferDataModel(null, btcWalletService,
bsqWalletService, empty, user, null, null, priceFeedService, null,
accountAgeWitnessService, feeService, txFeeEstimationService,
null, bsFormatter, mock(MakerFeeProvider.class), null);
CreateOfferDataModel dataModel = new CreateOfferDataModel(createOfferService, null, btcWalletService,
bsqWalletService, empty, user, null, priceFeedService,
accountAgeWitnessService, feeService,
bsFormatter, mock(MakerFeeProvider.class), null);
dataModel.initWithData(OfferPayload.Direction.BUY, new CryptoCurrency("BTC", "bitcoin"));
dataModel.activate();

View File

@ -11,6 +11,7 @@ import bisq.core.locale.Country;
import bisq.core.locale.CryptoCurrency;
import bisq.core.locale.GlobalSettings;
import bisq.core.locale.Res;
import bisq.core.offer.CreateOfferService;
import bisq.core.offer.OfferPayload;
import bisq.core.offer.OpenOffer;
import bisq.core.payment.CryptoCurrencyAccount;
@ -32,6 +33,8 @@ import javafx.collections.FXCollections;
import java.time.Instant;
import java.util.UUID;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@ -75,6 +78,7 @@ public class EditOfferDataModelTest {
BsqWalletService bsqWalletService = mock(BsqWalletService.class);
SecurityDepositValidator securityDepositValidator = mock(SecurityDepositValidator.class);
AccountAgeWitnessService accountAgeWitnessService = mock(AccountAgeWitnessService.class);
CreateOfferService createOfferService = mock(CreateOfferService.class);
when(btcWalletService.getOrCreateAddressEntry(anyString(), any())).thenReturn(addressEntry);
when(btcWalletService.getBalanceForAddress(any())).thenReturn(Coin.valueOf(1000L));
@ -88,12 +92,13 @@ public class EditOfferDataModelTest {
when(preferences.getUserCountry()).thenReturn(new Country("US", "United States", null));
when(bsqFormatter.formatCoin(any())).thenReturn("0");
when(bsqWalletService.getAvailableConfirmedBalance()).thenReturn(Coin.ZERO);
when(createOfferService.getRandomOfferId()).thenReturn(UUID.randomUUID().toString());
model = new EditOfferDataModel(null,
model = new EditOfferDataModel(createOfferService, null,
btcWalletService, bsqWalletService, empty, user,
null, null, priceFeedService, null,
null, priceFeedService,
accountAgeWitnessService, feeService, null, null,
null, null, mock(MakerFeeProvider.class), null);
mock(MakerFeeProvider.class), null);
}
@Test