Skip to content

Commit

Permalink
Adjust tests to new params
Browse files Browse the repository at this point in the history
  • Loading branch information
chimp1984 committed Nov 15, 2019
1 parent 50fc139 commit 9092160
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
6 changes: 3 additions & 3 deletions core/src/test/java/bisq/core/offer/OpenOfferManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void testStartEditOfferForActiveOffer() {

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,
Expand Down Expand Up @@ -73,7 +73,7 @@ public void testStartEditOfferForDeactivatedOffer() {

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,
Expand Down Expand Up @@ -101,7 +101,7 @@ public void testStartEditOfferForOfferThatIsCurrentlyEdited() {

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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

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;
Expand All @@ -21,6 +21,7 @@
import org.bitcoinj.core.Coin;

import java.util.HashSet;
import java.util.UUID;

import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -48,20 +49,20 @@ public void setUp() {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
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;
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;
Expand All @@ -51,6 +51,8 @@

import java.time.Instant;

import java.util.UUID;

import org.junit.Before;
import org.junit.Test;

Expand Down Expand Up @@ -89,7 +91,7 @@ public void setUp() {
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));
Expand All @@ -103,11 +105,12 @@ public void setUp() {
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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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;
Expand All @@ -32,6 +33,8 @@

import java.time.Instant;

import java.util.UUID;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -75,6 +78,7 @@ public void setUp() {
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));
Expand All @@ -88,12 +92,13 @@ public void setUp() {
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
Expand Down

0 comments on commit 9092160

Please sign in to comment.