mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 23:06:39 +01:00
Fix broken tests
This commit is contained in:
parent
2a8c25e33a
commit
358032b659
3 changed files with 15 additions and 4 deletions
|
@ -15,11 +15,14 @@ import bisq.core.payment.PaymentAccount;
|
||||||
import bisq.core.payment.RevolutAccount;
|
import bisq.core.payment.RevolutAccount;
|
||||||
import bisq.core.provider.fee.FeeService;
|
import bisq.core.provider.fee.FeeService;
|
||||||
import bisq.core.provider.price.PriceFeedService;
|
import bisq.core.provider.price.PriceFeedService;
|
||||||
|
import bisq.core.trade.statistics.TradeStatisticsManager;
|
||||||
import bisq.core.user.Preferences;
|
import bisq.core.user.Preferences;
|
||||||
import bisq.core.user.User;
|
import bisq.core.user.User;
|
||||||
|
|
||||||
import org.bitcoinj.core.Coin;
|
import org.bitcoinj.core.Coin;
|
||||||
|
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -52,17 +55,19 @@ public class CreateOfferDataModelTest {
|
||||||
CreateOfferService createOfferService = mock(CreateOfferService.class);
|
CreateOfferService createOfferService = mock(CreateOfferService.class);
|
||||||
preferences = mock(Preferences.class);
|
preferences = mock(Preferences.class);
|
||||||
user = mock(User.class);
|
user = mock(User.class);
|
||||||
|
var tradeStats = mock(TradeStatisticsManager.class);
|
||||||
|
|
||||||
when(btcWalletService.getOrCreateAddressEntry(anyString(), any())).thenReturn(addressEntry);
|
when(btcWalletService.getOrCreateAddressEntry(anyString(), any())).thenReturn(addressEntry);
|
||||||
when(preferences.isUsePercentageBasedPrice()).thenReturn(true);
|
when(preferences.isUsePercentageBasedPrice()).thenReturn(true);
|
||||||
when(preferences.getBuyerSecurityDepositAsPercent(null)).thenReturn(0.01);
|
when(preferences.getBuyerSecurityDepositAsPercent(null)).thenReturn(0.01);
|
||||||
when(createOfferService.getRandomOfferId()).thenReturn(UUID.randomUUID().toString());
|
when(createOfferService.getRandomOfferId()).thenReturn(UUID.randomUUID().toString());
|
||||||
|
when(tradeStats.getObservableTradeStatisticsSet()).thenReturn(FXCollections.observableSet());
|
||||||
|
|
||||||
makerFeeProvider = mock(MakerFeeProvider.class);
|
makerFeeProvider = mock(MakerFeeProvider.class);
|
||||||
model = new CreateOfferDataModel(createOfferService, null, btcWalletService,
|
model = new CreateOfferDataModel(createOfferService, null, btcWalletService,
|
||||||
null, preferences, user, null,
|
null, preferences, user, null,
|
||||||
priceFeedService, null,
|
priceFeedService, null,
|
||||||
feeService, null, makerFeeProvider, null);
|
feeService, null, makerFeeProvider, tradeStats, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -34,14 +34,16 @@ import bisq.core.locale.Res;
|
||||||
import bisq.core.offer.CreateOfferService;
|
import bisq.core.offer.CreateOfferService;
|
||||||
import bisq.core.offer.OfferPayload;
|
import bisq.core.offer.OfferPayload;
|
||||||
import bisq.core.payment.PaymentAccount;
|
import bisq.core.payment.PaymentAccount;
|
||||||
|
import bisq.core.payment.payload.PaymentMethod;
|
||||||
import bisq.core.provider.fee.FeeService;
|
import bisq.core.provider.fee.FeeService;
|
||||||
import bisq.core.provider.price.MarketPrice;
|
import bisq.core.provider.price.MarketPrice;
|
||||||
import bisq.core.provider.price.PriceFeedService;
|
import bisq.core.provider.price.PriceFeedService;
|
||||||
|
import bisq.core.trade.statistics.TradeStatisticsManager;
|
||||||
import bisq.core.user.Preferences;
|
import bisq.core.user.Preferences;
|
||||||
import bisq.core.user.User;
|
import bisq.core.user.User;
|
||||||
import bisq.core.util.coin.ImmutableCoinFormatter;
|
|
||||||
import bisq.core.util.coin.BsqFormatter;
|
import bisq.core.util.coin.BsqFormatter;
|
||||||
import bisq.core.util.coin.CoinFormatter;
|
import bisq.core.util.coin.CoinFormatter;
|
||||||
|
import bisq.core.util.coin.ImmutableCoinFormatter;
|
||||||
import bisq.core.util.validation.InputValidator;
|
import bisq.core.util.validation.InputValidator;
|
||||||
|
|
||||||
import bisq.common.config.Config;
|
import bisq.common.config.Config;
|
||||||
|
@ -95,6 +97,7 @@ public class CreateOfferViewModelTest {
|
||||||
SecurityDepositValidator securityDepositValidator = mock(SecurityDepositValidator.class);
|
SecurityDepositValidator securityDepositValidator = mock(SecurityDepositValidator.class);
|
||||||
AccountAgeWitnessService accountAgeWitnessService = mock(AccountAgeWitnessService.class);
|
AccountAgeWitnessService accountAgeWitnessService = mock(AccountAgeWitnessService.class);
|
||||||
CreateOfferService createOfferService = mock(CreateOfferService.class);
|
CreateOfferService createOfferService = mock(CreateOfferService.class);
|
||||||
|
var tradeStats = mock(TradeStatisticsManager.class);
|
||||||
|
|
||||||
when(btcWalletService.getOrCreateAddressEntry(anyString(), any())).thenReturn(addressEntry);
|
when(btcWalletService.getOrCreateAddressEntry(anyString(), any())).thenReturn(addressEntry);
|
||||||
when(btcWalletService.getBalanceForAddress(any())).thenReturn(Coin.valueOf(1000L));
|
when(btcWalletService.getBalanceForAddress(any())).thenReturn(Coin.valueOf(1000L));
|
||||||
|
@ -102,6 +105,7 @@ public class CreateOfferViewModelTest {
|
||||||
when(priceFeedService.getMarketPrice(anyString())).thenReturn(new MarketPrice("USD", 12684.0450, Instant.now().getEpochSecond(), true));
|
when(priceFeedService.getMarketPrice(anyString())).thenReturn(new MarketPrice("USD", 12684.0450, Instant.now().getEpochSecond(), true));
|
||||||
when(feeService.getTxFee(anyInt())).thenReturn(Coin.valueOf(1000L));
|
when(feeService.getTxFee(anyInt())).thenReturn(Coin.valueOf(1000L));
|
||||||
when(user.findFirstPaymentAccountWithCurrency(any())).thenReturn(paymentAccount);
|
when(user.findFirstPaymentAccountWithCurrency(any())).thenReturn(paymentAccount);
|
||||||
|
when(paymentAccount.getPaymentMethod()).thenReturn(mock(PaymentMethod.class));
|
||||||
when(user.getPaymentAccountsAsObservable()).thenReturn(FXCollections.observableSet());
|
when(user.getPaymentAccountsAsObservable()).thenReturn(FXCollections.observableSet());
|
||||||
when(securityDepositValidator.validate(any())).thenReturn(new InputValidator.ValidationResult(false));
|
when(securityDepositValidator.validate(any())).thenReturn(new InputValidator.ValidationResult(false));
|
||||||
when(accountAgeWitnessService.getMyTradeLimit(any(), any(), any())).thenReturn(100000000L);
|
when(accountAgeWitnessService.getMyTradeLimit(any(), any(), any())).thenReturn(100000000L);
|
||||||
|
@ -109,11 +113,12 @@ public class CreateOfferViewModelTest {
|
||||||
when(bsqFormatter.formatCoin(any())).thenReturn("0");
|
when(bsqFormatter.formatCoin(any())).thenReturn("0");
|
||||||
when(bsqWalletService.getAvailableConfirmedBalance()).thenReturn(Coin.ZERO);
|
when(bsqWalletService.getAvailableConfirmedBalance()).thenReturn(Coin.ZERO);
|
||||||
when(createOfferService.getRandomOfferId()).thenReturn(UUID.randomUUID().toString());
|
when(createOfferService.getRandomOfferId()).thenReturn(UUID.randomUUID().toString());
|
||||||
|
when(tradeStats.getObservableTradeStatisticsSet()).thenReturn(FXCollections.observableSet());
|
||||||
|
|
||||||
CreateOfferDataModel dataModel = new CreateOfferDataModel(createOfferService, null, btcWalletService,
|
CreateOfferDataModel dataModel = new CreateOfferDataModel(createOfferService, null, btcWalletService,
|
||||||
bsqWalletService, empty, user, null, priceFeedService,
|
bsqWalletService, empty, user, null, priceFeedService,
|
||||||
accountAgeWitnessService, feeService,
|
accountAgeWitnessService, feeService,
|
||||||
coinFormatter, mock(MakerFeeProvider.class), null);
|
coinFormatter, mock(MakerFeeProvider.class), tradeStats, null);
|
||||||
dataModel.initWithData(OfferPayload.Direction.BUY, new CryptoCurrency("BTC", "bitcoin"));
|
dataModel.initWithData(OfferPayload.Direction.BUY, new CryptoCurrency("BTC", "bitcoin"));
|
||||||
dataModel.activate();
|
dataModel.activate();
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import bisq.core.payment.PaymentAccount;
|
||||||
import bisq.core.provider.fee.FeeService;
|
import bisq.core.provider.fee.FeeService;
|
||||||
import bisq.core.provider.price.MarketPrice;
|
import bisq.core.provider.price.MarketPrice;
|
||||||
import bisq.core.provider.price.PriceFeedService;
|
import bisq.core.provider.price.PriceFeedService;
|
||||||
|
import bisq.core.trade.statistics.TradeStatisticsManager;
|
||||||
import bisq.core.user.Preferences;
|
import bisq.core.user.Preferences;
|
||||||
import bisq.core.user.User;
|
import bisq.core.user.User;
|
||||||
import bisq.core.util.coin.BsqFormatter;
|
import bisq.core.util.coin.BsqFormatter;
|
||||||
|
@ -95,7 +96,7 @@ public class EditOfferDataModelTest {
|
||||||
btcWalletService, bsqWalletService, empty, user,
|
btcWalletService, bsqWalletService, empty, user,
|
||||||
null, priceFeedService,
|
null, priceFeedService,
|
||||||
accountAgeWitnessService, feeService, null, null,
|
accountAgeWitnessService, feeService, null, null,
|
||||||
mock(MakerFeeProvider.class), null);
|
mock(MakerFeeProvider.class), mock(TradeStatisticsManager.class), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Add table
Reference in a new issue