@SuppressWarnings("unchecked") @Test public void testSendMessage() { Set<GatewayResponse> voiceResponseSet = new HashSet<GatewayResponse>(); voiceResponseSet.add(voiceGatewayResponse); expect(voiceManager.sendMessage(voiceGatewayRequest)).andReturn(voiceResponseSet); replay(voiceManager); compositeGateway.sendMessage(voiceGatewayRequest); verify(voiceManager); Set<GatewayResponse> textResponseSet = new HashSet<GatewayResponse>(); textResponseSet.add(textGatewayResponse); expect(textManager.sendMessage(textGatewayRequest)).andReturn(textResponseSet); replay(textManager); compositeGateway.sendMessage(textGatewayRequest); verify(textManager); }
@Transactional @SuppressWarnings("unchecked") public Set<GatewayResponse> sendMessage(GatewayRequest gatewayRequest) { if ( gatewayRequest .getMessageRequest() .getMessageType() == MessageType.VOICE ) { return voiceGatewayManager.sendMessage(gatewayRequest); } if ( gatewayRequest .getMessageRequest() .getMessageType() == MessageType.TEXT ) { return textGatewayManager.sendMessage(gatewayRequest); } return new HashSet<GatewayResponse>(); }
CompositeGatewayManager implements GatewayManager { @Transactional @SuppressWarnings("unchecked") public Set<GatewayResponse> sendMessage(GatewayRequest gatewayRequest) { if ( gatewayRequest .getMessageRequest() .getMessageType() == MessageType.VOICE ) { return voiceGatewayManager.sendMessage(gatewayRequest); } if ( gatewayRequest .getMessageRequest() .getMessageType() == MessageType.TEXT ) { return textGatewayManager.sendMessage(gatewayRequest); } return new HashSet<GatewayResponse>(); } }
CompositeGatewayManager implements GatewayManager { @Transactional @SuppressWarnings("unchecked") public Set<GatewayResponse> sendMessage(GatewayRequest gatewayRequest) { if ( gatewayRequest .getMessageRequest() .getMessageType() == MessageType.VOICE ) { return voiceGatewayManager.sendMessage(gatewayRequest); } if ( gatewayRequest .getMessageRequest() .getMessageType() == MessageType.TEXT ) { return textGatewayManager.sendMessage(gatewayRequest); } return new HashSet<GatewayResponse>(); }  }
CompositeGatewayManager implements GatewayManager { @Transactional @SuppressWarnings("unchecked") public Set<GatewayResponse> sendMessage(GatewayRequest gatewayRequest) { if ( gatewayRequest .getMessageRequest() .getMessageType() == MessageType.VOICE ) { return voiceGatewayManager.sendMessage(gatewayRequest); } if ( gatewayRequest .getMessageRequest() .getMessageType() == MessageType.TEXT ) { return textGatewayManager.sendMessage(gatewayRequest); } return new HashSet<GatewayResponse>(); }  String getMessageStatus(GatewayResponse response); MStatus mapMessageStatus(GatewayResponse response); @Transactional @SuppressWarnings("unchecked") Set<GatewayResponse> sendMessage(GatewayRequest gatewayRequest); GatewayMessageHandler getMessageHandler(); void setMessageHandler(GatewayMessageHandler messageHandler); CompositeGatewayMessageHandler getCompositeMessageHandler(); void setCompositeMessageHandler(
			CompositeGatewayMessageHandler compositeMessageHandler); GatewayManager getVoiceGatewayManager(); void setVoiceGatewayManager(GatewayManager voiceGatewayManager); GatewayManager getTextGatewayManager(); void setTextGatewayManager(GatewayManager textGatewayManager); }
CompositeGatewayManager implements GatewayManager { @Transactional @SuppressWarnings("unchecked") public Set<GatewayResponse> sendMessage(GatewayRequest gatewayRequest) { if ( gatewayRequest .getMessageRequest() .getMessageType() == MessageType.VOICE ) { return voiceGatewayManager.sendMessage(gatewayRequest); } if ( gatewayRequest .getMessageRequest() .getMessageType() == MessageType.TEXT ) { return textGatewayManager.sendMessage(gatewayRequest); } return new HashSet<GatewayResponse>(); }  String getMessageStatus(GatewayResponse response); MStatus mapMessageStatus(GatewayResponse response); @Transactional @SuppressWarnings("unchecked") Set<GatewayResponse> sendMessage(GatewayRequest gatewayRequest); GatewayMessageHandler getMessageHandler(); void setMessageHandler(GatewayMessageHandler messageHandler); CompositeGatewayMessageHandler getCompositeMessageHandler(); void setCompositeMessageHandler(
			CompositeGatewayMessageHandler compositeMessageHandler); GatewayManager getVoiceGatewayManager(); void setVoiceGatewayManager(GatewayManager voiceGatewayManager); GatewayManager getTextGatewayManager(); void setTextGatewayManager(GatewayManager textGatewayManager);  }