ZuluTrader101FXTweetHandler extends AbstractFXTweetHandler<String> { @Override public FXTradeTweet<String> handleTweet(Tweet tweet) { String tweetTxt = tweet.getText(); String tokens[] = tweetTxt.trim().split(TradingConstants.SPACE_RGX); if (tweetTxt.startsWith(CLOSED)) { return parseCloseTrade(tokens); } else if (tweetTxt.startsWith(BOUGHT) || tweetTxt.startsWith(SOLD)) { return parseNewTrade(tokens); } return null; } protected  ZuluTrader101FXTweetHandler(String userId); @Override FXTradeTweet<String> handleTweet(Tweet tweet); @Override Collection<Tweet> findHistoricPnlTweetsForInstrument(TradeableInstrument<String> instrument);  }
@Test public void handleTweetTest() { AbstractFXTweetHandler<String> tweetHandler = new ZuluTrader101FXTweetHandler(userId); ProviderHelper providerHelper = mock(ProviderHelper.class); tweetHandler.providerHelper = providerHelper; when(providerHelper.fromHashTagCurrency(eq("#EURUSD"))).thenReturn("EUR_USD"); when(providerHelper.fromHashTagCurrency(eq("#USDJPY"))).thenReturn("USD_JPY"); when(providerHelper.fromHashTagCurrency(eq("#GBPCHF"))).thenReturn("GBP_CHF"); when(providerHelper.fromHashTagCurrency(eq("#EURGBP"))).thenReturn("EUR_GBP"); when(providerHelper.fromHashTagCurrency(eq("#EURCHF"))).thenReturn("EUR_CHF"); when(providerHelper.fromHashTagCurrency(eq("#NZDUSD"))).thenReturn("NZD_USD"); newTradeType1(tweetHandler); newTradeType2(tweetHandler); newTradeType3(tweetHandler); newTradeType4(tweetHandler); newTradeType5(tweetHandler); newTradeType6(tweetHandler); closeTradeType1(tweetHandler); closeTradeType2(tweetHandler); }