@SuppressWarnings("unchecked") @Test public void testParseMessageResponse(){ Set<GatewayResponse> response = new HashSet<GatewayResponse>(); expect(voiceHandler.parseMessageResponse(voiceGatewayRequest, "OK")).andReturn(response); replay(voiceHandler); compositeHandler.parseMessageResponse(voiceGatewayRequest, "OK"); verify(voiceHandler); reset(voiceHandler); expect(textHandler.parseMessageResponse(textGatewayRequest, "OK")).andReturn(response); replay(textHandler); compositeHandler.parseMessageResponse(textGatewayRequest, "OK"); verify(textHandler); reset(textHandler); }
@SuppressWarnings("unchecked") public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { if ( message .getMessageRequest() .getMessageType() == MessageType.VOICE) return voiceHandler.parseMessageResponse(message, gatewayResponse); if ( message .getMessageRequest() .getMessageType() == MessageType.TEXT) return textHandler.parseMessageResponse(message, gatewayResponse); return null; }
CompositeGatewayMessageHandler implements GatewayMessageHandler { @SuppressWarnings("unchecked") public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { if ( message .getMessageRequest() .getMessageType() == MessageType.VOICE) return voiceHandler.parseMessageResponse(message, gatewayResponse); if ( message .getMessageRequest() .getMessageType() == MessageType.TEXT) return textHandler.parseMessageResponse(message, gatewayResponse); return null; } }
CompositeGatewayMessageHandler implements GatewayMessageHandler { @SuppressWarnings("unchecked") public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { if ( message .getMessageRequest() .getMessageType() == MessageType.VOICE) return voiceHandler.parseMessageResponse(message, gatewayResponse); if ( message .getMessageRequest() .getMessageType() == MessageType.TEXT) return textHandler.parseMessageResponse(message, gatewayResponse); return null; }  }
CompositeGatewayMessageHandler implements GatewayMessageHandler { @SuppressWarnings("unchecked") public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { if ( message .getMessageRequest() .getMessageType() == MessageType.VOICE) return voiceHandler.parseMessageResponse(message, gatewayResponse); if ( message .getMessageRequest() .getMessageType() == MessageType.TEXT) return textHandler.parseMessageResponse(message, gatewayResponse); return null; }  MStatus lookupResponse(String code); MStatus lookupStatus(String code); @SuppressWarnings("unchecked") Set<GatewayResponse> parseMessageResponse(GatewayRequest message,
			String gatewayResponse); MStatus parseMessageStatus(String messageStatus); CoreManager getCoreManager(); void setCoreManager(CoreManager coreManager); GatewayMessageHandler getVoiceHandler(); void setVoiceHandler(GatewayMessageHandler voiceHandler); GatewayMessageHandler getTextHandler(); void setTextHandler(GatewayMessageHandler textHandler); }
CompositeGatewayMessageHandler implements GatewayMessageHandler { @SuppressWarnings("unchecked") public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { if ( message .getMessageRequest() .getMessageType() == MessageType.VOICE) return voiceHandler.parseMessageResponse(message, gatewayResponse); if ( message .getMessageRequest() .getMessageType() == MessageType.TEXT) return textHandler.parseMessageResponse(message, gatewayResponse); return null; }  MStatus lookupResponse(String code); MStatus lookupStatus(String code); @SuppressWarnings("unchecked") Set<GatewayResponse> parseMessageResponse(GatewayRequest message,
			String gatewayResponse); MStatus parseMessageStatus(String messageStatus); CoreManager getCoreManager(); void setCoreManager(CoreManager coreManager); GatewayMessageHandler getVoiceHandler(); void setVoiceHandler(GatewayMessageHandler voiceHandler); GatewayMessageHandler getTextHandler(); void setTextHandler(GatewayMessageHandler textHandler);  }