### Question:
OfferBookViewModel extends ActivatableViewModel { String getPrice(OfferBookListItem item) { if ((item == null)) return ""; final Offer offer = item.getOffer(); final Price price = offer.getPrice(); if (price != null) { return formatPrice(offer, true) + formatMarketPriceMargin(offer, true); } else { return Res.get("shared.na"); } } @Inject  OfferBookViewModel(User user,
                              OpenOfferManager openOfferManager,
                              OfferBook offerBook,
                              Preferences preferences,
                              P2PService p2PService,
                              PriceFeedService priceFeedService,
                              ClosedTradableManager closedTradableManager,
                              FilterManager filterManager,
                              AccountAgeWitnessService accountAgeWitnessService,
                              Navigation navigation,
                              @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter,
                              BsqFormatter bsqFormatter); ObservableList<TradeCurrency> getTradeCurrencies(); boolean hasSelectionAccountSigning(); String getMakerFeeAsString(Offer offer); String formatDepositString(Coin deposit, long amount);  }### Answer:
@Test public void testGetPrice() { OfferBook offerBook = mock(OfferBook.class); OpenOfferManager openOfferManager = mock(OpenOfferManager.class); PriceFeedService priceFeedService = mock(PriceFeedService.class); final ObservableList<OfferBookListItem> offerBookListItems = FXCollections.observableArrayList(); when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); when(priceFeedService.getMarketPrice(anyString())).thenReturn(new MarketPrice("USD", 12684.0450, Instant.now().getEpochSecond(), true)); final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, null, null, null, null, coinFormatter, new BsqFormatter()); final OfferBookListItem item = make(btcBuyItem.but( with(useMarketBasedPrice, true), with(marketPriceMargin, -0.12))); final OfferBookListItem lowItem = make(btcBuyItem.but( with(useMarketBasedPrice, true), with(marketPriceMargin, 0.01))); final OfferBookListItem fixedItem = make(btcBuyItem); item.getOffer().setPriceFeedService(priceFeedService); lowItem.getOffer().setPriceFeedService(priceFeedService); offerBookListItems.addAll(lowItem, fixedItem); model.activate(); assertEquals("12557.2046 (1.00%)", model.getPrice(lowItem)); assertEquals("10.0000", model.getPrice(fixedItem)); offerBookListItems.addAll(item); assertEquals("14206.1304 (-12.00%)", model.getPrice(item)); assertEquals("12557.2046 (1.00%)", model.getPrice(lowItem)); }