### Question:
TxFeeEstimationService { @VisibleForTesting static boolean isInTolerance(int estimatedSize, int txSize, double tolerance) { checkArgument(estimatedSize > 0, "estimatedSize must be positive"); checkArgument(txSize > 0, "txSize must be positive"); checkArgument(tolerance > 0, "tolerance must be positive"); double deviation = Math.abs(1 - ((double) estimatedSize / (double) txSize)); return deviation <= tolerance; } @Inject  TxFeeEstimationService(FeeService feeService,
                                  BtcWalletService btcWalletService,
                                  Preferences preferences); Tuple2<Coin, Integer> getEstimatedFeeAndTxSizeForTaker(Coin fundsNeededForTrade, Coin tradeFee); Tuple2<Coin, Integer> getEstimatedFeeAndTxSizeForMaker(Coin reservedFundsForOffer,
                                                                  Coin tradeFee); Tuple2<Coin, Integer> getEstimatedFeeAndTxSize(Coin amount,
                                                          FeeService feeService,
                                                          BtcWalletService btcWalletService); static int TYPICAL_TX_WITH_1_INPUT_SIZE; }### Answer:
@Test public void testIsInTolerance() { int estimatedSize; int txSize; double tolerance; boolean result; estimatedSize = 100; txSize = 100; tolerance = 0.0001; result = TxFeeEstimationService.isInTolerance(estimatedSize, txSize, tolerance); assertTrue(result); estimatedSize = 100; txSize = 200; tolerance = 0.2; result = TxFeeEstimationService.isInTolerance(estimatedSize, txSize, tolerance); assertFalse(result); estimatedSize = 120; txSize = 100; tolerance = 0.2; result = TxFeeEstimationService.isInTolerance(estimatedSize, txSize, tolerance); assertTrue(result); estimatedSize = 200; txSize = 100; tolerance = 1; result = TxFeeEstimationService.isInTolerance(estimatedSize, txSize, tolerance); assertTrue(result); estimatedSize = 201; txSize = 100; tolerance = 1; result = TxFeeEstimationService.isInTolerance(estimatedSize, txSize, tolerance); assertFalse(result); }