use of bisq.desktop.util.BSFormatter in project bisq-desktop by bisq-network.
the class OfferBookViewModelTest method testMaxCharactersForAmountRange.
@Test
public void testMaxCharactersForAmountRange() {
OfferBook offerBook = mock(OfferBook.class);
OpenOfferManager openOfferManager = mock(OpenOfferManager.class);
final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList();
offerBookListItems.addAll(make(OfferBookListItemMaker.btcItemWithRange));
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, null, null, null, null, null, new BSFormatter());
model.activate();
assertEquals(15, model.maxPlacesForAmount.intValue());
offerBookListItems.addAll(make(btcItemWithRange.but(with(amount, 2000000000L))));
assertEquals(16, model.maxPlacesForAmount.intValue());
offerBookListItems.addAll(make(btcItemWithRange.but(with(minAmount, 30000000000L), with(amount, 30000000000L))));
assertEquals(19, model.maxPlacesForAmount.intValue());
}
use of bisq.desktop.util.BSFormatter in project bisq-desktop by bisq-network.
the class OfferBookViewModelTest method testMaxCharactersForVolume.
@Test
public void testMaxCharactersForVolume() {
OfferBook offerBook = mock(OfferBook.class);
OpenOfferManager openOfferManager = mock(OpenOfferManager.class);
final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList();
offerBookListItems.addAll(make(OfferBookListItemMaker.btcItem));
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, null, null, null, null, null, new BSFormatter());
model.activate();
assertEquals(8, model.maxPlacesForVolume.intValue());
offerBookListItems.addAll(make(btcItem.but(with(amount, 2000000000L))));
assertEquals(10, model.maxPlacesForVolume.intValue());
}
use of bisq.desktop.util.BSFormatter in project bisq-desktop by bisq-network.
the class OfferBookViewModelTest method testMaxCharactersForAmount.
@Test
public void testMaxCharactersForAmount() {
OfferBook offerBook = mock(OfferBook.class);
OpenOfferManager openOfferManager = mock(OpenOfferManager.class);
final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList();
offerBookListItems.addAll(make(OfferBookListItemMaker.btcItem));
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, null, null, null, null, null, new BSFormatter());
model.activate();
assertEquals(6, model.maxPlacesForAmount.intValue());
offerBookListItems.addAll(make(btcItem.but(with(amount, 2000000000L))));
assertEquals(7, model.maxPlacesForAmount.intValue());
}
use of bisq.desktop.util.BSFormatter in project bisq-desktop by bisq-network.
the class OfferBookViewModelTest method testMaxCharactersForPriceWithNoOffers.
@Test
public void testMaxCharactersForPriceWithNoOffers() {
OfferBook offerBook = mock(OfferBook.class);
final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList();
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
final OfferBookViewModel model = new OfferBookViewModel(null, null, offerBook, empty, null, null, null, null, null, null, null, new BSFormatter());
assertEquals(0, model.maxPlacesForPrice.intValue());
}
use of bisq.desktop.util.BSFormatter in project bisq-desktop by bisq-network.
the class OfferBookViewModelTest method testMaxCharactersForAmountWithNoOffes.
@Test
public void testMaxCharactersForAmountWithNoOffes() {
OfferBook offerBook = mock(OfferBook.class);
final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList();
when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems);
final OfferBookViewModel model = new OfferBookViewModel(null, null, offerBook, empty, null, null, null, null, null, null, null, new BSFormatter());
assertEquals(0, model.maxPlacesForAmount.intValue());
}
Aggregations