### Question:
DisplayUtils { public static String formatVolume(Offer offer, Boolean decimalAligned, int maxNumberOfDigits) { return formatVolume(offer, decimalAligned, maxNumberOfDigits, true); }  static String formatDateTime(Date date); static String formatDateTimeSpan(Date dateFrom, Date dateTo); static String formatTime(Date date); static String formatDate(Date date); static String formatAccountAge(long durationMillis); static String booleanToYesNo(boolean value); static String formatVolume(Offer offer, Boolean decimalAligned, int maxNumberOfDigits); static String formatVolume(Offer offer, Boolean decimalAligned, int maxNumberOfDigits, boolean showRange); static String formatVolume(Volume volume); static String formatVolumeWithCode(Volume volume); static String formatVolumeLabel(String currencyCode); static String formatVolumeLabel(String currencyCode, String postFix); static String getDirectionWithCode(OfferPayload.Direction direction, String currencyCode); static String getDirectionBothSides(OfferPayload.Direction direction, String currencyCode); static String getDirectionForBuyer(boolean isMyOffer, String currencyCode); static String getDirectionForSeller(boolean isMyOffer, String currencyCode); static String getDirectionForTakeOffer(OfferPayload.Direction direction, String currencyCode); static String getOfferDirectionForCreateOffer(OfferPayload.Direction direction, String currencyCode); static String formatAmount(Offer offer, CoinFormatter coinFormatter); static String formatAmount(Offer offer,
                                      int decimalPlaces,
                                      boolean decimalAligned,
                                      int maxPlaces,
                                      CoinFormatter coinFormatter); static String formatPrice(Price price, Boolean decimalAligned, int maxPlaces); static String getFeeWithFiatAmount(Coin makerFeeAsCoin,
                                              Optional<Volume> optionalFeeInFiat,
                                              CoinFormatter formatter); static Coin parseToCoinWith4Decimals(String input, CoinFormatter coinFormatter); static boolean hasBtcValidDecimals(String input, CoinFormatter coinFormatter); static Coin reduceTo4Decimals(Coin coin, CoinFormatter coinFormatter);  }### Answer:
@Test public void testFormatVolume() { assertEquals("1", DisplayUtils.formatVolume(make(btcUsdOffer), true, 4)); assertEquals("100", DisplayUtils.formatVolume(make(usdVolume))); assertEquals("1775", DisplayUtils.formatVolume(make(usdVolume.but(with(volumeString, "1774.62"))))); }
@Test public void testFormatSameVolume() { Offer offer = mock(Offer.class); Volume btc = Volume.parse("0.10", "BTC"); when(offer.getMinVolume()).thenReturn(btc); when(offer.getVolume()).thenReturn(btc); assertEquals("0.10000000", DisplayUtils.formatVolume(offer.getVolume())); }
@Test public void testFormatDifferentVolume() { Offer offer = mock(Offer.class); Volume btcMin = Volume.parse("0.10", "BTC"); Volume btcMax = Volume.parse("0.25", "BTC"); when(offer.isRange()).thenReturn(true); when(offer.getMinVolume()).thenReturn(btcMin); when(offer.getVolume()).thenReturn(btcMax); assertEquals("0.10000000 - 0.25000000", DisplayUtils.formatVolume(offer, false, 0)); }
@Test public void testFormatNullVolume() { Offer offer = mock(Offer.class); when(offer.getMinVolume()).thenReturn(null); when(offer.getVolume()).thenReturn(null); assertEquals("", DisplayUtils.formatVolume(offer.getVolume())); }