@Test public void shouldPerformAllStrategy() throws TokenStrategyFailedException { BlobStrategy first = mock(BlobStrategy.class); BlobStrategy second = mock(BlobStrategy.class); BlobStrategy third = mock(BlobStrategy.class); given(factory.getStrategies(any(CoreTokenConfig.class))) .willReturn(Arrays.asList(first, second, third)); Token mockToken = mock(Token.class); TokenBlobStrategy strategy = new TokenBlobStrategy(factory, config); strategy.perfom(mockToken); verify(first).perform(mockToken); verify(second).perform(mockToken); verify(third).perform(mockToken); }
public void perfom(Token token) throws TokenStrategyFailedException { for (BlobStrategy strategy : strategies) { strategy.perform(token); } }
TokenBlobStrategy { public void perfom(Token token) throws TokenStrategyFailedException { for (BlobStrategy strategy : strategies) { strategy.perform(token); } } }
TokenBlobStrategy { public void perfom(Token token) throws TokenStrategyFailedException { for (BlobStrategy strategy : strategies) { strategy.perform(token); } } @Inject  TokenBlobStrategy(TokenStrategyFactory factory, CoreTokenConfig config); }
TokenBlobStrategy { public void perfom(Token token) throws TokenStrategyFailedException { for (BlobStrategy strategy : strategies) { strategy.perform(token); } } @Inject  TokenBlobStrategy(TokenStrategyFactory factory, CoreTokenConfig config); void perfom(Token token); void reverse(Token token); }
TokenBlobStrategy { public void perfom(Token token) throws TokenStrategyFailedException { for (BlobStrategy strategy : strategies) { strategy.perform(token); } } @Inject  TokenBlobStrategy(TokenStrategyFactory factory, CoreTokenConfig config); void perfom(Token token); void reverse(Token token);  }