public class DefaultRouterTest {
@Test
public void testNoRoute() throws TimeoutException, GatewayException, IOException, InterruptedException {
List<AGateway> gateways=new ArrayList<AGateway>();
AGateway gateway=new GatewayMock("G1");
gateways.add(gateway);
gateway=new GatewayMock("G2");
gateways.add(gateway);
gateway=new GatewayMock("G3");
gateways.add(gateway);
ARouter router=new DefaultRouter();
OutboundMessage message=new OutboundMessage("77374847", "test");
Collection<AGateway> candidates= router.route(message, gateways);
Assert.assertEquals("No route expected. No started gateways and no outbound gateways.", 0, candidates.size());
gateway.setAttributes(AGateway.GatewayAttributes.SEND);
gateway.setOutbound(true);
message.setGatewayId("G3");
gateway=gateways.get(0);
gateway.startGateway();
candidates= router.route(message, gateways);
Assert.assertEquals("No route expected. No outbound gateways started.", 0, candidates.size());
}