### Question:
TradeStatisticsManager { public ObservableSet<TradeStatistics2> getObservableTradeStatisticsSet() { return observableTradeStatisticsSet; } @Inject  TradeStatisticsManager(P2PService p2PService,
                                  PriceFeedService priceFeedService,
                                  TradeStatistics2StorageService tradeStatistics2StorageService,
                                  AppendOnlyDataStoreService appendOnlyDataStoreService,
                                  @Named(Config.STORAGE_DIR) File storageDir,
                                  @Named(Config.DUMP_STATISTICS) boolean dumpStatistics); void onAllServicesInitialized(); ObservableSet<TradeStatistics2> getObservableTradeStatisticsSet();  }### Answer:
@Test public void addToSet_ObjectWithNullDepositTxId() { listenerArgumentCaptor.getValue().onAdded(tradeWithNullDepositTxId); assertTrue(manager.getObservableTradeStatisticsSet().contains(tradeWithNullDepositTxId)); }
@Test public void addToSet_RemoveExistingObjectIfObjectWithNullDepositTxIdIsAdded() { TradeStatistics2 tradeWithDepositTxId = make(dayZeroTrade); listenerArgumentCaptor.getValue().onAdded(tradeWithDepositTxId); listenerArgumentCaptor.getValue().onAdded(tradeWithNullDepositTxId); assertFalse(manager.getObservableTradeStatisticsSet().contains(tradeWithDepositTxId)); assertTrue(manager.getObservableTradeStatisticsSet().contains(tradeWithNullDepositTxId)); }
@Test public void addToSet_NotRemoveExistingObjectIfObjectsNotEqual() { TradeStatistics2 tradeWithDepositTxId = make(dayZeroTrade.but(with(tradeAmount, Coin.FIFTY_COINS))); listenerArgumentCaptor.getValue().onAdded(tradeWithDepositTxId); listenerArgumentCaptor.getValue().onAdded(tradeWithNullDepositTxId); assertTrue(manager.getObservableTradeStatisticsSet().contains(tradeWithDepositTxId)); assertFalse(manager.getObservableTradeStatisticsSet().contains(tradeWithNullDepositTxId)); }
@Test public void addToSet_IgnoreObjectIfObjectWithNullDepositTxIdAlreadyExists() { TradeStatistics2 tradeWithDepositTxId = make(dayZeroTrade); listenerArgumentCaptor.getValue().onAdded(tradeWithNullDepositTxId); listenerArgumentCaptor.getValue().onAdded(tradeWithDepositTxId); assertTrue(manager.getObservableTradeStatisticsSet().contains(tradeWithNullDepositTxId)); assertFalse(manager.getObservableTradeStatisticsSet().contains(tradeWithDepositTxId)); }