@Test public void responseMatchExpected() throws Exception { List<WaiterAcceptor> waiterAcceptorsList = new ArrayList<WaiterAcceptor>(); waiterAcceptorsList.add(new TestExceptionAcceptor()); waiterAcceptorsList.add(new TestResultAcceptor()); CompositeAcceptor compositeAcceptor = new CompositeAcceptor(waiterAcceptorsList); Assert.assertEquals("Response output doesn't match expected output.", WaiterState.SUCCESS, compositeAcceptor.accepts(new DescribeTableResult())); }
public WaiterState accepts(Output response) { for (WaiterAcceptor<Output> acceptor : acceptors) { if (acceptor.matches(response)) { return acceptor.getState(); } } return WaiterState.RETRY; }
CompositeAcceptor { public WaiterState accepts(Output response) { for (WaiterAcceptor<Output> acceptor : acceptors) { if (acceptor.matches(response)) { return acceptor.getState(); } } return WaiterState.RETRY; } }
CompositeAcceptor { public WaiterState accepts(Output response) { for (WaiterAcceptor<Output> acceptor : acceptors) { if (acceptor.matches(response)) { return acceptor.getState(); } } return WaiterState.RETRY; } CompositeAcceptor(List<WaiterAcceptor<Output>> acceptors); }
CompositeAcceptor { public WaiterState accepts(Output response) { for (WaiterAcceptor<Output> acceptor : acceptors) { if (acceptor.matches(response)) { return acceptor.getState(); } } return WaiterState.RETRY; } CompositeAcceptor(List<WaiterAcceptor<Output>> acceptors); List<WaiterAcceptor<Output>> getAcceptors(); WaiterState accepts(Output response); WaiterState accepts(AmazonServiceException exception); }
CompositeAcceptor { public WaiterState accepts(Output response) { for (WaiterAcceptor<Output> acceptor : acceptors) { if (acceptor.matches(response)) { return acceptor.getState(); } } return WaiterState.RETRY; } CompositeAcceptor(List<WaiterAcceptor<Output>> acceptors); List<WaiterAcceptor<Output>> getAcceptors(); WaiterState accepts(Output response); WaiterState accepts(AmazonServiceException exception);  }