target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testValidate() { System.out.println("validate"); IncomingMessageFormParameter param = new IncomingMessageFormParameterImpl(); param.setValue("10"); ParamRangeValidator instance = new ParamRangeValidator(); instance.setMaxValue(5f); instance.setMinValue(0f); boolean expResult = false; boolean result = ... | public boolean validate(IncomingMessageFormParameter param) { Float value; if(param.getValue().isEmpty()) return true; try { value = Float.parseFloat(param.getValue()); } catch (NumberFormatException ex) { param.setErrCode(1); param.setErrText("wrong format"); param.setMessageFormParamStatus(IncMessageFormParameterStat... | ParamRangeValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { Float value; if(param.getValue().isEmpty()) return true; try { value = Float.parseFloat(param.getValue()); } catch (NumberFormatException ex) { param.setErrCode(1); param.setErrText("wron... | ParamRangeValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { Float value; if(param.getValue().isEmpty()) return true; try { value = Float.parseFloat(param.getValue()); } catch (NumberFormatException ex) { param.setErrCode(1); param.setErrText("wron... | ParamRangeValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { Float value; if(param.getValue().isEmpty()) return true; try { value = Float.parseFloat(param.getValue()); } catch (NumberFormatException ex) { param.setErrCode(1); param.setErrText("wron... | ParamRangeValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { Float value; if(param.getValue().isEmpty()) return true; try { value = Float.parseFloat(param.getValue()); } catch (NumberFormatException ex) { param.setErrCode(1); param.setErrText("wron... |
@Test public void testValidate() { System.out.println("validate"); IncomingMessageFormParameter param1 = new IncomingMessageFormParameterImpl(); param1.setDateCreated(new Date()); param1.setName("parent"); param1.setValue("value"); IncomingMessageForm form = new IncomingMessageFormImpl(); form.setIncomingMsgFormParamet... | public boolean validate(IncomingMessageForm form, List<SubField> subFields, CoreManager coreManager) { boolean valid = true; for(SubField sf : subFields) { if(!form.getIncomingMsgFormParameters().containsKey(sf.getParentField().toLowerCase())) continue; IncomingMessageFormParameter parent = form.getIncomingMsgFormParam... | ConditionalRequirementValidator { public boolean validate(IncomingMessageForm form, List<SubField> subFields, CoreManager coreManager) { boolean valid = true; for(SubField sf : subFields) { if(!form.getIncomingMsgFormParameters().containsKey(sf.getParentField().toLowerCase())) continue; IncomingMessageFormParameter par... | ConditionalRequirementValidator { public boolean validate(IncomingMessageForm form, List<SubField> subFields, CoreManager coreManager) { boolean valid = true; for(SubField sf : subFields) { if(!form.getIncomingMsgFormParameters().containsKey(sf.getParentField().toLowerCase())) continue; IncomingMessageFormParameter par... | ConditionalRequirementValidator { public boolean validate(IncomingMessageForm form, List<SubField> subFields, CoreManager coreManager) { boolean valid = true; for(SubField sf : subFields) { if(!form.getIncomingMsgFormParameters().containsKey(sf.getParentField().toLowerCase())) continue; IncomingMessageFormParameter par... | ConditionalRequirementValidator { public boolean validate(IncomingMessageForm form, List<SubField> subFields, CoreManager coreManager) { boolean valid = true; for(SubField sf : subFields) { if(!form.getIncomingMsgFormParameters().containsKey(sf.getParentField().toLowerCase())) continue; IncomingMessageFormParameter par... |
@Test public void testValidate() { System.out.println("validate"); IncomingMessageFormParameter param = new IncomingMessageFormParameterImpl(); param.setIncomingMsgFormParamDefinition(new IncomingMessageFormParameterDefinitionImpl()); param.getIncomingMsgFormParamDefinition().setParamType("BOOLEAN"); param.setValue("y"... | public boolean validate(IncomingMessageFormParameter param) { String value = caseSensitive ? param.getValue().trim() : param.getValue().trim().toUpperCase(); param.setMessageFormParamStatus(IncMessageFormParameterStatus.INVALID); param.setValue(value); if (!values.isEmpty()){ String[] valArr = values.split(","); for(St... | ParamValueValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { String value = caseSensitive ? param.getValue().trim() : param.getValue().trim().toUpperCase(); param.setMessageFormParamStatus(IncMessageFormParameterStatus.INVALID); param.setValue(valu... | ParamValueValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { String value = caseSensitive ? param.getValue().trim() : param.getValue().trim().toUpperCase(); param.setMessageFormParamStatus(IncMessageFormParameterStatus.INVALID); param.setValue(valu... | ParamValueValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { String value = caseSensitive ? param.getValue().trim() : param.getValue().trim().toUpperCase(); param.setMessageFormParamStatus(IncMessageFormParameterStatus.INVALID); param.setValue(valu... | ParamValueValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { String value = caseSensitive ? param.getValue().trim() : param.getValue().trim().toUpperCase(); param.setMessageFormParamStatus(IncMessageFormParameterStatus.INVALID); param.setValue(valu... |
@Test public void testValidate() { System.out.println("validate"); IncomingMessageFormParameter param = new IncomingMessageFormParameterImpl(); param.setValue("2010.12.10"); param.setMessageFormParamStatus(IncMessageFormParameterStatus.NEW); param.setIncomingMsgFormParamDefinition(new IncomingMessageFormParameterDefini... | public boolean validate(IncomingMessageFormParameter param) { param.setMessageFormParamStatus(IncMessageFormParameterStatus.VALID); int paramLength = param.getValue().trim().length(); int maxLength = param.getIncomingMsgFormParamDefinition().getLength(); if (paramLength > maxLength) { param.setErrCode(2); param.setErrT... | ParamSizeValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { param.setMessageFormParamStatus(IncMessageFormParameterStatus.VALID); int paramLength = param.getValue().trim().length(); int maxLength = param.getIncomingMsgFormParamDefinition().getLengt... | ParamSizeValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { param.setMessageFormParamStatus(IncMessageFormParameterStatus.VALID); int paramLength = param.getValue().trim().length(); int maxLength = param.getIncomingMsgFormParamDefinition().getLengt... | ParamSizeValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { param.setMessageFormParamStatus(IncMessageFormParameterStatus.VALID); int paramLength = param.getValue().trim().length(); int maxLength = param.getIncomingMsgFormParamDefinition().getLengt... | ParamSizeValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { param.setMessageFormParamStatus(IncMessageFormParameterStatus.VALID); int paramLength = param.getValue().trim().length(); int maxLength = param.getIncomingMsgFormParamDefinition().getLengt... |
@Test public void testExecute() { System.out.println("execute"); String requesterPhone = "000000000000"; IncomingMessage message = new IncomingMessageImpl(); String expResult = "An unexpected error occurred! Please try again."; IncomingMessageFormImpl msgForm = new IncomingMessageFormImpl(); msgForm.setMessageFormStatu... | public IncomingMessageResponse execute(IncomingMessage message, String requesterPhone) { IncomingMessageResponse response; String wsResponse = null; logger.info("Initializing session"); IncomingMessageSession imSession = initializeSession(message, requesterPhone); logger.info("Generating form"); IncomingMessageForm for... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageResponse execute(IncomingMessage message, String requesterPhone) { IncomingMessageResponse response; String wsResponse = null; logger.info("Initializing session"); IncomingMessageSession imSession = initializeSession(message, re... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageResponse execute(IncomingMessage message, String requesterPhone) { IncomingMessageResponse response; String wsResponse = null; logger.info("Initializing session"); IncomingMessageSession imSession = initializeSession(message, re... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageResponse execute(IncomingMessage message, String requesterPhone) { IncomingMessageResponse response; String wsResponse = null; logger.info("Initializing session"); IncomingMessageSession imSession = initializeSession(message, re... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageResponse execute(IncomingMessage message, String requesterPhone) { IncomingMessageResponse response; String wsResponse = null; logger.info("Initializing session"); IncomingMessageSession imSession = initializeSession(message, re... |
@Test public void testInitializeSession() { System.out.println("initializeSession"); IncomingMessage message = new IncomingMessageImpl(); String requesterPhone = "000000000000"; mockSessDao = createMock(IncomingMessageSessionDAO.class); expect( applicationContext.getBean("incomingMessageSession", IncomingMessageSession... | public IncomingMessageSession initializeSession(IncomingMessage message, String requesterPhone) { String formCode = parser.getFormCode(message.getContent()); IncomingMessageSession imSession = (IncomingMessageSession) applicationContext.getBean("incomingMessageSession", IncomingMessageSession.class); imSession.setFormC... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageSession initializeSession(IncomingMessage message, String requesterPhone) { String formCode = parser.getFormCode(message.getContent()); IncomingMessageSession imSession = (IncomingMessageSession) applicationContext.getBean("inco... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageSession initializeSession(IncomingMessage message, String requesterPhone) { String formCode = parser.getFormCode(message.getContent()); IncomingMessageSession imSession = (IncomingMessageSession) applicationContext.getBean("inco... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageSession initializeSession(IncomingMessage message, String requesterPhone) { String formCode = parser.getFormCode(message.getContent()); IncomingMessageSession imSession = (IncomingMessageSession) applicationContext.getBean("inco... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageSession initializeSession(IncomingMessage message, String requesterPhone) { String formCode = parser.getFormCode(message.getContent()); IncomingMessageSession imSession = (IncomingMessageSession) applicationContext.getBean("inco... |
@Test public void testInitializeForm() { System.out.println("initializeForm"); IncomingMessage message = new IncomingMessageImpl(); message.setContent("test content"); String formCode = "GENERAL"; mockFormDefDao = createMock(IncomingMessageFormDefinitionDAO.class); mockFormDao = createMock(IncomingMessageFormDAO.class)... | public IncomingMessageForm initializeForm(IncomingMessage message, String formCode) { IncomingMessageFormDefinition formDefn = ((IncomingMessageFormDefinitionDAO)applicationContext.getBean("incomingMessageFormDefinitionDAO", IncomingMessageFormDefinitionDAO.class)).getByCode(formCode); if (formDefn == null) { return nu... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageForm initializeForm(IncomingMessage message, String formCode) { IncomingMessageFormDefinition formDefn = ((IncomingMessageFormDefinitionDAO)applicationContext.getBean("incomingMessageFormDefinitionDAO", IncomingMessageFormDefini... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageForm initializeForm(IncomingMessage message, String formCode) { IncomingMessageFormDefinition formDefn = ((IncomingMessageFormDefinitionDAO)applicationContext.getBean("incomingMessageFormDefinitionDAO", IncomingMessageFormDefini... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageForm initializeForm(IncomingMessage message, String formCode) { IncomingMessageFormDefinition formDefn = ((IncomingMessageFormDefinitionDAO)applicationContext.getBean("incomingMessageFormDefinitionDAO", IncomingMessageFormDefini... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageForm initializeForm(IncomingMessage message, String formCode) { IncomingMessageFormDefinition formDefn = ((IncomingMessageFormDefinitionDAO)applicationContext.getBean("incomingMessageFormDefinitionDAO", IncomingMessageFormDefini... |
@Test public void testPrepareResponse() { System.out.println("prepareResponse"); IncomingMessage message = new IncomingMessageImpl(); mockRespDao = createMock(IncomingMessageResponseDAO.class); expect( applicationContext.getBean("incomingMessageResponse", IncomingMessageResponse.class) ).andReturn(new IncomingMessageRe... | public IncomingMessageResponse prepareResponse(IncomingMessage message, String wsResponse) { IncomingMessageForm form = message.getIncomingMessageForm(); IncomingMessageResponse response = (IncomingMessageResponse) applicationContext.getBean("incomingMessageResponse", IncomingMessageResponse.class); response.setDateCre... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageResponse prepareResponse(IncomingMessage message, String wsResponse) { IncomingMessageForm form = message.getIncomingMessageForm(); IncomingMessageResponse response = (IncomingMessageResponse) applicationContext.getBean("incomin... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageResponse prepareResponse(IncomingMessage message, String wsResponse) { IncomingMessageForm form = message.getIncomingMessageForm(); IncomingMessageResponse response = (IncomingMessageResponse) applicationContext.getBean("incomin... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageResponse prepareResponse(IncomingMessage message, String wsResponse) { IncomingMessageForm form = message.getIncomingMessageForm(); IncomingMessageResponse response = (IncomingMessageResponse) applicationContext.getBean("incomin... | FormCommandAction implements CommandAction, ApplicationContextAware { public IncomingMessageResponse prepareResponse(IncomingMessage message, String wsResponse) { IncomingMessageForm form = message.getIncomingMessageForm(); IncomingMessageResponse response = (IncomingMessageResponse) applicationContext.getBean("incomin... |
@Test public void testGetByUnexistantCode() { System.out.print("test Language getByCode with unexistant code"); String code = "dd"; Language result = lDao.getByCode(code); Assert.assertNull(result); } | public Language getByCode(String code) { logger.debug("variable passed to getByCode: " + code); try { Language lang = (Language) this.getSessionFactory().getCurrentSession().createCriteria(LanguageImpl.class).add(Restrictions.eq("code", code)).uniqueResult(); logger.debug(lang); return lang; } catch (NonUniqueResultExc... | LanguageDAOImpl extends HibernateGenericDAOImpl<LanguageImpl> implements LanguageDAO<LanguageImpl> { public Language getByCode(String code) { logger.debug("variable passed to getByCode: " + code); try { Language lang = (Language) this.getSessionFactory().getCurrentSession().createCriteria(LanguageImpl.class).add(Restri... | LanguageDAOImpl extends HibernateGenericDAOImpl<LanguageImpl> implements LanguageDAO<LanguageImpl> { public Language getByCode(String code) { logger.debug("variable passed to getByCode: " + code); try { Language lang = (Language) this.getSessionFactory().getCurrentSession().createCriteria(LanguageImpl.class).add(Restri... | LanguageDAOImpl extends HibernateGenericDAOImpl<LanguageImpl> implements LanguageDAO<LanguageImpl> { public Language getByCode(String code) { logger.debug("variable passed to getByCode: " + code); try { Language lang = (Language) this.getSessionFactory().getCurrentSession().createCriteria(LanguageImpl.class).add(Restri... | LanguageDAOImpl extends HibernateGenericDAOImpl<LanguageImpl> implements LanguageDAO<LanguageImpl> { public Language getByCode(String code) { logger.debug("variable passed to getByCode: " + code); try { Language lang = (Language) this.getSessionFactory().getCurrentSession().createCriteria(LanguageImpl.class).add(Restri... |
@Test public void testParseRequest() { System.out.println("parseRequest"); String message = "Type=GENERAL\naction=test\nmessage=Test,, Tester"; expect( mockCore.createIncomingMessage() ).andReturn(new IncomingMessageImpl()); replay(mockCore); IncomingMessage result = imParser.parseRequest(message); verify(mockCore); as... | public IncomingMessage parseRequest(String message) { IncomingMessage inMsg = coreManager.createIncomingMessage(); inMsg.setContent(message.trim()); inMsg.setDateCreated(new Date()); inMsg.setMessageStatus(IncMessageStatus.PROCESSING); return inMsg; } | IncomingMessageParserImpl implements IncomingMessageParser { public IncomingMessage parseRequest(String message) { IncomingMessage inMsg = coreManager.createIncomingMessage(); inMsg.setContent(message.trim()); inMsg.setDateCreated(new Date()); inMsg.setMessageStatus(IncMessageStatus.PROCESSING); return inMsg; } } | IncomingMessageParserImpl implements IncomingMessageParser { public IncomingMessage parseRequest(String message) { IncomingMessage inMsg = coreManager.createIncomingMessage(); inMsg.setContent(message.trim()); inMsg.setDateCreated(new Date()); inMsg.setMessageStatus(IncMessageStatus.PROCESSING); return inMsg; } } | IncomingMessageParserImpl implements IncomingMessageParser { public IncomingMessage parseRequest(String message) { IncomingMessage inMsg = coreManager.createIncomingMessage(); inMsg.setContent(message.trim()); inMsg.setDateCreated(new Date()); inMsg.setMessageStatus(IncMessageStatus.PROCESSING); return inMsg; } Incomi... | IncomingMessageParserImpl implements IncomingMessageParser { public IncomingMessage parseRequest(String message) { IncomingMessage inMsg = coreManager.createIncomingMessage(); inMsg.setContent(message.trim()); inMsg.setDateCreated(new Date()); inMsg.setMessageStatus(IncMessageStatus.PROCESSING); return inMsg; } Incomi... |
@Test public void testGetComand() { System.out.println("getComand"); String message = "Type=GENERAL\naction=test\nmessage=Test,, Tester"; String expResult = "type"; String result = imParser.getCommand(message); assertEquals(expResult, result); message = "someting=test Type"; expResult = ""; result = imParser.getCommand... | public String getCommand(String message) { String command = ""; Pattern pattern = Pattern.compile(cmdRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); } return command.toLowerCase(); } | IncomingMessageParserImpl implements IncomingMessageParser { public String getCommand(String message) { String command = ""; Pattern pattern = Pattern.compile(cmdRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); } return command.toLowerCase(); } } | IncomingMessageParserImpl implements IncomingMessageParser { public String getCommand(String message) { String command = ""; Pattern pattern = Pattern.compile(cmdRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); } return command.toLowerCase(); } } | IncomingMessageParserImpl implements IncomingMessageParser { public String getCommand(String message) { String command = ""; Pattern pattern = Pattern.compile(cmdRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); } return command.toLowerCase(); } IncomingMessage... | IncomingMessageParserImpl implements IncomingMessageParser { public String getCommand(String message) { String command = ""; Pattern pattern = Pattern.compile(cmdRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); } return command.toLowerCase(); } IncomingMessage... |
@Test public void testGetFormCode() { System.out.println("getFormCode"); String message = "Type=GENERAL\naction=test\nmessage=Test,, Tester"; String expResult = "GENERAL"; String result = imParser.getFormCode(message); assertEquals(expResult, result); } | public String getFormCode(String message) { String command = ""; String formCode = ""; Pattern pattern = Pattern.compile(typeRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); String[] formCodeParts = command.trim().split("="); if (formCodeParts.length == 2) { fo... | IncomingMessageParserImpl implements IncomingMessageParser { public String getFormCode(String message) { String command = ""; String formCode = ""; Pattern pattern = Pattern.compile(typeRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); String[] formCodeParts = c... | IncomingMessageParserImpl implements IncomingMessageParser { public String getFormCode(String message) { String command = ""; String formCode = ""; Pattern pattern = Pattern.compile(typeRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); String[] formCodeParts = c... | IncomingMessageParserImpl implements IncomingMessageParser { public String getFormCode(String message) { String command = ""; String formCode = ""; Pattern pattern = Pattern.compile(typeRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); String[] formCodeParts = c... | IncomingMessageParserImpl implements IncomingMessageParser { public String getFormCode(String message) { String command = ""; String formCode = ""; Pattern pattern = Pattern.compile(typeRegex); Matcher matcher = pattern.matcher(message.trim()); if (matcher.find()) { command = matcher.group(); String[] formCodeParts = c... |
@Test public void testGetParams() { System.out.println("getParams"); String message = "Type=GENERAL\naction=test\nmessage=Test, Dream Tester\ndob = 01.01.01\ndue-date=right. now\ntest_format=all"; List<IncomingMessageFormParameter> expResult = new ArrayList<IncomingMessageFormParameter>(); IncomingMessageFormParameter ... | public Map<String, IncomingMessageFormParameter> getParams(String message) { Map<String, IncomingMessageFormParameter> params = new HashMap<String, IncomingMessageFormParameter>(); List<String> pList = new ArrayList<String>(); if (delimiter != null && !delimiter.equals("")) { String[] paramArr = message.split(delimiter... | IncomingMessageParserImpl implements IncomingMessageParser { public Map<String, IncomingMessageFormParameter> getParams(String message) { Map<String, IncomingMessageFormParameter> params = new HashMap<String, IncomingMessageFormParameter>(); List<String> pList = new ArrayList<String>(); if (delimiter != null && !delimi... | IncomingMessageParserImpl implements IncomingMessageParser { public Map<String, IncomingMessageFormParameter> getParams(String message) { Map<String, IncomingMessageFormParameter> params = new HashMap<String, IncomingMessageFormParameter>(); List<String> pList = new ArrayList<String>(); if (delimiter != null && !delimi... | IncomingMessageParserImpl implements IncomingMessageParser { public Map<String, IncomingMessageFormParameter> getParams(String message) { Map<String, IncomingMessageFormParameter> params = new HashMap<String, IncomingMessageFormParameter>(); List<String> pList = new ArrayList<String>(); if (delimiter != null && !delimi... | IncomingMessageParserImpl implements IncomingMessageParser { public Map<String, IncomingMessageFormParameter> getParams(String message) { Map<String, IncomingMessageFormParameter> params = new HashMap<String, IncomingMessageFormParameter>(); List<String> pList = new ArrayList<String>(); if (delimiter != null && !delimi... |
@Test public void testGetElement() { System.out.println("getElement"); String xml = "<?xml version='1.0' encoding='UTF-8' ?><rootElement><sample>sometest</sample></rootElement>"; InputStream in = new ByteArrayInputStream(xml.getBytes()); SAXBuilder saxb = new SAXBuilder(); Document doc = null; try { doc = saxb.build(in... | public Element getElement(Document doc, String tagName) { Element result = null; if (tagName != null) { Element root = doc.getRootElement(); if (tagName.equals(root.getName())) { result = root; } else { List children = root.getChildren(); for(Object o : children) { Element e = (Element) o; if (e.getName() != null && e.... | XMLUtil { public Element getElement(Document doc, String tagName) { Element result = null; if (tagName != null) { Element root = doc.getRootElement(); if (tagName.equals(root.getName())) { result = root; } else { List children = root.getChildren(); for(Object o : children) { Element e = (Element) o; if (e.getName() != ... | XMLUtil { public Element getElement(Document doc, String tagName) { Element result = null; if (tagName != null) { Element root = doc.getRootElement(); if (tagName.equals(root.getName())) { result = root; } else { List children = root.getChildren(); for(Object o : children) { Element e = (Element) o; if (e.getName() != ... | XMLUtil { public Element getElement(Document doc, String tagName) { Element result = null; if (tagName != null) { Element root = doc.getRootElement(); if (tagName.equals(root.getName())) { result = root; } else { List children = root.getChildren(); for(Object o : children) { Element e = (Element) o; if (e.getName() != ... | XMLUtil { public Element getElement(Document doc, String tagName) { Element result = null; if (tagName != null) { Element root = doc.getRootElement(); if (tagName.equals(root.getName())) { result = root; } else { List children = root.getChildren(); for(Object o : children) { Element e = (Element) o; if (e.getName() != ... |
@Test public void testValidate() { System.out.println("validate"); IncomingMessageFormParameter param = new IncomingMessageFormParameterImpl(); param.setValue("2010.12.10"); param.setMessageFormParamStatus(IncMessageFormParameterStatus.NEW); param.setIncomingMsgFormParamDefinition(new IncomingMessageFormParameterDefini... | public boolean validate(IncomingMessageFormParameter param) { if(param.getMessageFormParamStatus() == IncMessageFormParameterStatus.INVALID) return false; String paramType = param.getIncomingMsgFormParamDefinition().getParamType().toUpperCase(); if(paramType.indexOf("TIME") >= 0){ try{ SimpleDateFormat dFormat = new Si... | ParamExpressionValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { if(param.getMessageFormParamStatus() == IncMessageFormParameterStatus.INVALID) return false; String paramType = param.getIncomingMsgFormParamDefinition().getParamType().toUpperCase()... | ParamExpressionValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { if(param.getMessageFormParamStatus() == IncMessageFormParameterStatus.INVALID) return false; String paramType = param.getIncomingMsgFormParamDefinition().getParamType().toUpperCase()... | ParamExpressionValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { if(param.getMessageFormParamStatus() == IncMessageFormParameterStatus.INVALID) return false; String paramType = param.getIncomingMsgFormParamDefinition().getParamType().toUpperCase()... | ParamExpressionValidator implements IncomingMessageFormParameterValidator { public boolean validate(IncomingMessageFormParameter param) { if(param.getMessageFormParamStatus() == IncMessageFormParameterStatus.INVALID) return false; String paramType = param.getIncomingMsgFormParamDefinition().getParamType().toUpperCase()... |
@Test public void testToSMSMessage() throws Exception{ System.out.println("toSMSMessage"); String xml = "<?xml version='1.0' encoding='UTF-8' ?><patientreg description-template=\"${/patientreg/lastname}$ in ${/patientreg/continent}$\" id=\"1\" name=\"Patient Registration\" xmlns:xf=\"http: String expResult = "Type=pati... | public String toSMSMessage(String xml) throws JDOMException, IOException, MotechParseException { String result = ""; InputStream in = new ByteArrayInputStream(xml.getBytes()); SAXBuilder saxb = new SAXBuilder(); Document doc = null; doc = saxb.build(in); Element root = doc.getRootElement(); Element formTypeElement = ge... | IncomingMessageXMLParserImpl implements IncomingMessageXMLParser { public String toSMSMessage(String xml) throws JDOMException, IOException, MotechParseException { String result = ""; InputStream in = new ByteArrayInputStream(xml.getBytes()); SAXBuilder saxb = new SAXBuilder(); Document doc = null; doc = saxb.build(in)... | IncomingMessageXMLParserImpl implements IncomingMessageXMLParser { public String toSMSMessage(String xml) throws JDOMException, IOException, MotechParseException { String result = ""; InputStream in = new ByteArrayInputStream(xml.getBytes()); SAXBuilder saxb = new SAXBuilder(); Document doc = null; doc = saxb.build(in)... | IncomingMessageXMLParserImpl implements IncomingMessageXMLParser { public String toSMSMessage(String xml) throws JDOMException, IOException, MotechParseException { String result = ""; InputStream in = new ByteArrayInputStream(xml.getBytes()); SAXBuilder saxb = new SAXBuilder(); Document doc = null; doc = saxb.build(in)... | IncomingMessageXMLParserImpl implements IncomingMessageXMLParser { public String toSMSMessage(String xml) throws JDOMException, IOException, MotechParseException { String result = ""; InputStream in = new ByteArrayInputStream(xml.getBytes()); SAXBuilder saxb = new SAXBuilder(); Document doc = null; doc = saxb.build(in)... |
@Test public void testValidate(){ System.out.println("validate"); String reqPhone = "000000000000"; instance.setConditionalRequirements(new HashMap<String, List<SubField>>()); instance.setConditionalValidator(new ConditionalRequirementValidator()); IncomingMessageFormParameterDefinitionImpl pDef1 = new IncomingMessageF... | public IncMessageFormStatus validate(IncomingMessageForm form, String requesterPhone) { ValidatorGroup group; IncMessageFormStatus status; form.setMessageFormStatus(IncMessageFormStatus.VALID); List<SubField> subs = null; List<SubField> conditionals = null; if (subFields != null && subFields.containsKey(form.getIncomin... | IncomingMessageFormValidatorImpl implements IncomingMessageFormValidator { public IncMessageFormStatus validate(IncomingMessageForm form, String requesterPhone) { ValidatorGroup group; IncMessageFormStatus status; form.setMessageFormStatus(IncMessageFormStatus.VALID); List<SubField> subs = null; List<SubField> conditio... | IncomingMessageFormValidatorImpl implements IncomingMessageFormValidator { public IncMessageFormStatus validate(IncomingMessageForm form, String requesterPhone) { ValidatorGroup group; IncMessageFormStatus status; form.setMessageFormStatus(IncMessageFormStatus.VALID); List<SubField> subs = null; List<SubField> conditio... | IncomingMessageFormValidatorImpl implements IncomingMessageFormValidator { public IncMessageFormStatus validate(IncomingMessageForm form, String requesterPhone) { ValidatorGroup group; IncMessageFormStatus status; form.setMessageFormStatus(IncMessageFormStatus.VALID); List<SubField> subs = null; List<SubField> conditio... | IncomingMessageFormValidatorImpl implements IncomingMessageFormValidator { public IncMessageFormStatus validate(IncomingMessageForm form, String requesterPhone) { ValidatorGroup group; IncMessageFormStatus status; form.setMessageFormStatus(IncMessageFormStatus.VALID); List<SubField> subs = null; List<SubField> conditio... |
@Test public void testDoAction() { } | public void doAction(GatewayResponse response){ } | RetryStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ } } | RetryStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ } } | RetryStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ } void doAction(GatewayResponse response); } | RetryStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ } void doAction(GatewayResponse response); } |
@Test public void testCreateOMIService() { System.out.println("createOMIService"); OMIService result = omiManager.createOMIService(); assertNotNull(result); } | public OMIService createOMIService() { try{ return (OMIService)context.getBean("omiService"); } catch(Exception ex){ logger.fatal("OMIService creation failed", ex); throw new RuntimeException("Service creation failure: OMI service unavailable."); } } | OMIManagerImpl implements OMIManager, ApplicationContextAware { public OMIService createOMIService() { try{ return (OMIService)context.getBean("omiService"); } catch(Exception ex){ logger.fatal("OMIService creation failed", ex); throw new RuntimeException("Service creation failure: OMI service unavailable."); } } } | OMIManagerImpl implements OMIManager, ApplicationContextAware { public OMIService createOMIService() { try{ return (OMIService)context.getBean("omiService"); } catch(Exception ex){ logger.fatal("OMIService creation failed", ex); throw new RuntimeException("Service creation failure: OMI service unavailable."); } } } | OMIManagerImpl implements OMIManager, ApplicationContextAware { public OMIService createOMIService() { try{ return (OMIService)context.getBean("omiService"); } catch(Exception ex){ logger.fatal("OMIService creation failed", ex); throw new RuntimeException("Service creation failure: OMI service unavailable."); } } void... | OMIManagerImpl implements OMIManager, ApplicationContextAware { public OMIService createOMIService() { try{ return (OMIService)context.getBean("omiService"); } catch(Exception ex){ logger.fatal("OMIService creation failed", ex); throw new RuntimeException("Service creation failure: OMI service unavailable."); } } void... |
@Test public void testGetTemplateByLangNotifMType() { System.out.println("getTemplateByLangNotifMType"); mtDao.getSessionFactory().getCurrentSession().save(mt2); MessageTemplate result = mtDao.getTemplateByLangNotifMType(l1, nt2, type); Assert.assertNotNull(result); Assert.assertEquals(mt2, result); } | public MessageTemplate getTemplateByLangNotifMType(Language lang, NotificationType notif, MessageType type) { logger.debug("variables passed to getTemplateByLangNotifMType. language: " + lang + "And NotificationType: " + notif + "And MessageType: " + type); try { MessageTemplate template = (MessageTemplate) this.getSes... | MessageTemplateDAOImpl extends HibernateGenericDAOImpl<MessageTemplateImpl> implements MessageTemplateDAO<MessageTemplateImpl> { public MessageTemplate getTemplateByLangNotifMType(Language lang, NotificationType notif, MessageType type) { logger.debug("variables passed to getTemplateByLangNotifMType. language: " + lang... | MessageTemplateDAOImpl extends HibernateGenericDAOImpl<MessageTemplateImpl> implements MessageTemplateDAO<MessageTemplateImpl> { public MessageTemplate getTemplateByLangNotifMType(Language lang, NotificationType notif, MessageType type) { logger.debug("variables passed to getTemplateByLangNotifMType. language: " + lang... | MessageTemplateDAOImpl extends HibernateGenericDAOImpl<MessageTemplateImpl> implements MessageTemplateDAO<MessageTemplateImpl> { public MessageTemplate getTemplateByLangNotifMType(Language lang, NotificationType notif, MessageType type) { logger.debug("variables passed to getTemplateByLangNotifMType. language: " + lang... | MessageTemplateDAOImpl extends HibernateGenericDAOImpl<MessageTemplateImpl> implements MessageTemplateDAO<MessageTemplateImpl> { public MessageTemplate getTemplateByLangNotifMType(Language lang, NotificationType notif, MessageType type) { logger.debug("variables passed to getTemplateByLangNotifMType. language: " + lang... |
@Test public void testCreateMessageStoreManager() { System.out.println("createMessageStoreManager"); MessageStoreManager result = omiManager.createMessageStoreManager(); assertNotNull(result); } | public MessageStoreManager createMessageStoreManager() { try{ return (MessageStoreManager)context.getBean("storeManager"); } catch(Exception ex){ logger.error("MessageStoreManager creation failed", ex); return null; } } | OMIManagerImpl implements OMIManager, ApplicationContextAware { public MessageStoreManager createMessageStoreManager() { try{ return (MessageStoreManager)context.getBean("storeManager"); } catch(Exception ex){ logger.error("MessageStoreManager creation failed", ex); return null; } } } | OMIManagerImpl implements OMIManager, ApplicationContextAware { public MessageStoreManager createMessageStoreManager() { try{ return (MessageStoreManager)context.getBean("storeManager"); } catch(Exception ex){ logger.error("MessageStoreManager creation failed", ex); return null; } } } | OMIManagerImpl implements OMIManager, ApplicationContextAware { public MessageStoreManager createMessageStoreManager() { try{ return (MessageStoreManager)context.getBean("storeManager"); } catch(Exception ex){ logger.error("MessageStoreManager creation failed", ex); return null; } } void setApplicationContext(Applicat... | OMIManagerImpl implements OMIManager, ApplicationContextAware { public MessageStoreManager createMessageStoreManager() { try{ return (MessageStoreManager)context.getBean("storeManager"); } catch(Exception ex){ logger.error("MessageStoreManager creation failed", ex); return null; } } void setApplicationContext(Applicat... |
@Test public void testCreateMessageFormatter() { System.out.println("createMessageFormatter"); SMSMessageFormatter result = omiManager.createMessageFormatter(); assertNotNull(result); } | public SMSMessageFormatter createMessageFormatter() { try{ return (SMSMessageFormatter)context.getBean("messageFormatter"); } catch(Exception ex){ logger.error("SMSMessageFormatter creation failed", ex); return null; } } | OMIManagerImpl implements OMIManager, ApplicationContextAware { public SMSMessageFormatter createMessageFormatter() { try{ return (SMSMessageFormatter)context.getBean("messageFormatter"); } catch(Exception ex){ logger.error("SMSMessageFormatter creation failed", ex); return null; } } } | OMIManagerImpl implements OMIManager, ApplicationContextAware { public SMSMessageFormatter createMessageFormatter() { try{ return (SMSMessageFormatter)context.getBean("messageFormatter"); } catch(Exception ex){ logger.error("SMSMessageFormatter creation failed", ex); return null; } } } | OMIManagerImpl implements OMIManager, ApplicationContextAware { public SMSMessageFormatter createMessageFormatter() { try{ return (SMSMessageFormatter)context.getBean("messageFormatter"); } catch(Exception ex){ logger.error("SMSMessageFormatter creation failed", ex); return null; } } void setApplicationContext(Applica... | OMIManagerImpl implements OMIManager, ApplicationContextAware { public SMSMessageFormatter createMessageFormatter() { try{ return (SMSMessageFormatter)context.getBean("messageFormatter"); } catch(Exception ex){ logger.error("SMSMessageFormatter creation failed", ex); return null; } } void setApplicationContext(Applica... |
@Test public void testConstructMessage() { System.out.println("consrtuctMessage"); MessageRequest message = new MessageRequestImpl(); message.setMessageType(MessageType.TEXT); Language defaultLang = new LanguageImpl(); message.setPersInfos(new HashSet<NameValuePair>()); message.setNotificationType(new NotificationTypeI... | public GatewayRequest constructMessage(MessageRequest messageRequest, Language defaultLang) { GatewayRequest gatewayRequest = buildGatewayRequest(messageRequest); GatewayRequestDetails gatewayDetails = (GatewayRequestDetails) applicationContext.getBean("gatewayRequestDetails", GatewayRequestDetails.class); gatewayDetai... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public GatewayRequest constructMessage(MessageRequest messageRequest, Language defaultLang) { GatewayRequest gatewayRequest = buildGatewayRequest(messageRequest); GatewayRequestDetails gatewayDetails = (GatewayRequestDetails) applicationC... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public GatewayRequest constructMessage(MessageRequest messageRequest, Language defaultLang) { GatewayRequest gatewayRequest = buildGatewayRequest(messageRequest); GatewayRequestDetails gatewayDetails = (GatewayRequestDetails) applicationC... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public GatewayRequest constructMessage(MessageRequest messageRequest, Language defaultLang) { GatewayRequest gatewayRequest = buildGatewayRequest(messageRequest); GatewayRequestDetails gatewayDetails = (GatewayRequestDetails) applicationC... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public GatewayRequest constructMessage(MessageRequest messageRequest, Language defaultLang) { GatewayRequest gatewayRequest = buildGatewayRequest(messageRequest); GatewayRequestDetails gatewayDetails = (GatewayRequestDetails) applicationC... |
@Test public void testParseTemplate() { System.out.println("parseTemplate"); String tpl = "Testing the <method> method of the <class> class"; Set<NameValuePair> params = new HashSet<NameValuePair>(); params.add(new NameValuePair("method", "parseTemplate")); params.add(new NameValuePair("class", "MessageStoreManagerImpl... | public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value = detail.getValue(); if (value != null && !value.isEmpty()) template = template.re... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value ... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value ... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value ... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value ... |
@Test public void testParseTemplate_MissingParam() { System.out.println("parseTemplate"); String tpl = "Testing the <method> method of the <class> class"; Set<NameValuePair> params = new HashSet<NameValuePair>(); params.add(new NameValuePair("method", "parseTemplate")); String expResult = "Testing the parseTemplate met... | public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value = detail.getValue(); if (value != null && !value.isEmpty()) template = template.re... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value ... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value ... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value ... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value ... |
@Test public void testParseTemplate_NULLParam() { System.out.println("parseTemplate"); String tpl = "Testing the <method> method of the <class> class"; String result = instance.parseTemplate(tpl, null); assertEquals(tpl, result); } | public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value = detail.getValue(); if (value != null && !value.isEmpty()) template = template.re... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value ... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value ... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value ... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String parseTemplate(String template, Set<NameValuePair> templateParams) { String tag, value; if (templateParams == null) { return template; } for (NameValuePair detail : templateParams) { tag = "<" + detail.getName() + ">"; value ... |
@Test public void testFetchTemplate() { System.out.println("fetchTemplate"); mockTemplateDao = createMock(MessageTemplateDAO.class); MessageRequest message = new MessageRequestImpl(); Language defaultLang = new LanguageImpl(); message.setNotificationType(new NotificationTypeImpl()); expect( mockCore.createMessageTempla... | String fetchTemplate(MessageRequest messageData, Language defaultLang) { if (messageData.getNotificationType() == null) return ""; MessageTemplate template = coreManager.createMessageTemplateDAO().getTemplateByLangNotifMType(messageData.getLanguage(), messageData.getNotificationType(), messageData.getMessageType(), def... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { String fetchTemplate(MessageRequest messageData, Language defaultLang) { if (messageData.getNotificationType() == null) return ""; MessageTemplate template = coreManager.createMessageTemplateDAO().getTemplateByLangNotifMType(messageData.g... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { String fetchTemplate(MessageRequest messageData, Language defaultLang) { if (messageData.getNotificationType() == null) return ""; MessageTemplate template = coreManager.createMessageTemplateDAO().getTemplateByLangNotifMType(messageData.g... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { String fetchTemplate(MessageRequest messageData, Language defaultLang) { if (messageData.getNotificationType() == null) return ""; MessageTemplate template = coreManager.createMessageTemplateDAO().getTemplateByLangNotifMType(messageData.g... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { String fetchTemplate(MessageRequest messageData, Language defaultLang) { if (messageData.getNotificationType() == null) return ""; MessageTemplate template = coreManager.createMessageTemplateDAO().getTemplateByLangNotifMType(messageData.g... |
@Test public void countryCodeShouldBeAppendedForTextMessageRecipients() { String formattedNumber = instance.formatPhoneNumber("0123456789,0223423456", MessageType.TEXT); assertEquals("233123456789,233223423456",formattedNumber); assertEquals("233111111111",instance.formatPhoneNumber("0111111111",MessageType.TEXT)); ass... | public String formatPhoneNumber(String requesterPhone, MessageType type) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String[] recipients = requesterPhone.split(DELIMITER); StringBuilder builder = new StringBuilder(); for (String recipient : recipients) { builder.append(format(recipient, t... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String formatPhoneNumber(String requesterPhone, MessageType type) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String[] recipients = requesterPhone.split(DELIMITER); StringBuilder builder = new StringB... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String formatPhoneNumber(String requesterPhone, MessageType type) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String[] recipients = requesterPhone.split(DELIMITER); StringBuilder builder = new StringB... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String formatPhoneNumber(String requesterPhone, MessageType type) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String[] recipients = requesterPhone.split(DELIMITER); StringBuilder builder = new StringB... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String formatPhoneNumber(String requesterPhone, MessageType type) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String[] recipients = requesterPhone.split(DELIMITER); StringBuilder builder = new StringB... |
@Test public void leadingZeroShouldBeRemovedForVoiceMessageRecipients() { String formattedNumber = instance.formatPhoneNumber("0123456789,0223423456", MessageType.VOICE); assertEquals("123456789,223423456",formattedNumber); assertEquals("111111111",instance.formatPhoneNumber("111111111",MessageType.VOICE)); assertEqual... | public String formatPhoneNumber(String requesterPhone, MessageType type) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String[] recipients = requesterPhone.split(DELIMITER); StringBuilder builder = new StringBuilder(); for (String recipient : recipients) { builder.append(format(recipient, t... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String formatPhoneNumber(String requesterPhone, MessageType type) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String[] recipients = requesterPhone.split(DELIMITER); StringBuilder builder = new StringB... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String formatPhoneNumber(String requesterPhone, MessageType type) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String[] recipients = requesterPhone.split(DELIMITER); StringBuilder builder = new StringB... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String formatPhoneNumber(String requesterPhone, MessageType type) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String[] recipients = requesterPhone.split(DELIMITER); StringBuilder builder = new StringB... | MessageStoreManagerImpl implements MessageStoreManager, ApplicationContextAware { public String formatPhoneNumber(String requesterPhone, MessageType type) { if (requesterPhone == null || requesterPhone.isEmpty()) { return null; } String[] recipients = requesterPhone.split(DELIMITER); StringBuilder builder = new StringB... |
@Test public void testDoAction(){ System.out.println("doAction"); GatewayRequest messageDetails = new GatewayRequestImpl(); messageDetails.setDateFrom(new Date()); messageDetails.setMessage("a message for testing"); messageDetails.setDateTo(new Date()); messageDetails.setRecipientsNumber("000000000000"); messageDetails... | public void doAction(GatewayResponse response){ LogType logType; String summary = "Status of message with id " + response.getRequestId() + " is: " + response.getMessageStatus().toString() + ". Response from gateway was: " + response.getResponseText(); if(response.getMessageStatus() == MStatus.DELIVERED){ logType = LogT... | LogStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ LogType logType; String summary = "Status of message with id " + response.getRequestId() + " is: " + response.getMessageStatus().toString() + ". Response from gateway was: " + response.getResponseText(); if(response.getMessage... | LogStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ LogType logType; String summary = "Status of message with id " + response.getRequestId() + " is: " + response.getMessageStatus().toString() + ". Response from gateway was: " + response.getResponseText(); if(response.getMessage... | LogStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ LogType logType; String summary = "Status of message with id " + response.getRequestId() + " is: " + response.getMessageStatus().toString() + ". Response from gateway was: " + response.getResponseText(); if(response.getMessage... | LogStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response){ LogType logType; String summary = "Status of message with id " + response.getRequestId() + " is: " + response.getMessageStatus().toString() + ". Response from gateway was: " + response.getResponseText(); if(response.getMessage... |
@Test public void testCreateIMPService() { System.out.println("createIMPService"); IMPService result = impManager.createIMPService(); assertNotNull(result); } | public IMPService createIMPService(){ return (IMPService)context.getBean("impService"); } | IMPManagerImpl implements ApplicationContextAware, IMPManager { public IMPService createIMPService(){ return (IMPService)context.getBean("impService"); } } | IMPManagerImpl implements ApplicationContextAware, IMPManager { public IMPService createIMPService(){ return (IMPService)context.getBean("impService"); } } | IMPManagerImpl implements ApplicationContextAware, IMPManager { public IMPService createIMPService(){ return (IMPService)context.getBean("impService"); } IMPService createIMPService(); IncomingMessageParser createIncomingMessageParser(); IncomingMessageXMLParser createIncomingMessageXMLParser(); IncomingMessageFormVal... | IMPManagerImpl implements ApplicationContextAware, IMPManager { public IMPService createIMPService(){ return (IMPService)context.getBean("impService"); } IMPService createIMPService(); IncomingMessageParser createIncomingMessageParser(); IncomingMessageXMLParser createIncomingMessageXMLParser(); IncomingMessageFormVal... |
@Test public void testDoAction(){ System.out.println("doAction"); GatewayRequestDetails grd = new GatewayRequestDetailsImpl(); grd.setId(17000000002l); GatewayRequest messageDetails = new GatewayRequestImpl(); messageDetails.setDateFrom(new Date()); messageDetails.setMessage("a message for testing"); messageDetails.set... | public void doAction(GatewayResponse response) { if (response.getRequestId() == null || response.getRequestId().isEmpty()) { return; } if (response.getRecipientNumber() == null || response.getRecipientNumber().isEmpty()) { return; } try { if (response.getMessageStatus() == MStatus.DELIVERED) { getRegWs().setMessageStat... | ReportStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response) { if (response.getRequestId() == null || response.getRequestId().isEmpty()) { return; } if (response.getRecipientNumber() == null || response.getRecipientNumber().isEmpty()) { return; } try { if (response.getMessageStatus() ... | ReportStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response) { if (response.getRequestId() == null || response.getRequestId().isEmpty()) { return; } if (response.getRecipientNumber() == null || response.getRecipientNumber().isEmpty()) { return; } try { if (response.getMessageStatus() ... | ReportStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response) { if (response.getRequestId() == null || response.getRequestId().isEmpty()) { return; } if (response.getRecipientNumber() == null || response.getRecipientNumber().isEmpty()) { return; } try { if (response.getMessageStatus() ... | ReportStatusActionImpl implements StatusAction { public void doAction(GatewayResponse response) { if (response.getRequestId() == null || response.getRequestId().isEmpty()) { return; } if (response.getRecipientNumber() == null || response.getRecipientNumber().isEmpty()) { return; } try { if (response.getMessageStatus() ... |
@Test public void testHandleStatus(){ System.out.println("handleStatus"); GatewayResponse response = new GatewayResponseImpl(); response.setGatewayMessageId("DoActionwerfet54y56g645v4e"); response.setMessageStatus(MStatus.DELIVERED); response.setRecipientNumber("000000000000"); response.setResponseText("Some gateway re... | public void handleStatus(GatewayResponse response) { List<StatusAction> actions = actionRegister.get(response.getMessageStatus()); if (actions != null) { for (StatusAction action : actions) { action.doAction(response); } } } | StatusHandlerImpl implements StatusHandler { public void handleStatus(GatewayResponse response) { List<StatusAction> actions = actionRegister.get(response.getMessageStatus()); if (actions != null) { for (StatusAction action : actions) { action.doAction(response); } } } } | StatusHandlerImpl implements StatusHandler { public void handleStatus(GatewayResponse response) { List<StatusAction> actions = actionRegister.get(response.getMessageStatus()); if (actions != null) { for (StatusAction action : actions) { action.doAction(response); } } } } | StatusHandlerImpl implements StatusHandler { public void handleStatus(GatewayResponse response) { List<StatusAction> actions = actionRegister.get(response.getMessageStatus()); if (actions != null) { for (StatusAction action : actions) { action.doAction(response); } } } void handleStatus(GatewayResponse response); bool... | StatusHandlerImpl implements StatusHandler { public void handleStatus(GatewayResponse response) { List<StatusAction> actions = actionRegister.get(response.getMessageStatus()); if (actions != null) { for (StatusAction action : actions) { action.doAction(response); } } } void handleStatus(GatewayResponse response); bool... |
@Test public void testregisterStatusAction(){ System.out.println("registerStatusAction"); List<StatusAction> actionList = new ArrayList<StatusAction>(); expect( mockRegister.get((MStatus)anyObject()) ).andReturn(actionList); replay(mockRegister); instance.registerStatusAction(MStatus.PENDING, mockAction); verify(mockRe... | public boolean registerStatusAction(MStatus status, StatusAction action) { return actionRegister.get(status).add(action); } | StatusHandlerImpl implements StatusHandler { public boolean registerStatusAction(MStatus status, StatusAction action) { return actionRegister.get(status).add(action); } } | StatusHandlerImpl implements StatusHandler { public boolean registerStatusAction(MStatus status, StatusAction action) { return actionRegister.get(status).add(action); } } | StatusHandlerImpl implements StatusHandler { public boolean registerStatusAction(MStatus status, StatusAction action) { return actionRegister.get(status).add(action); } void handleStatus(GatewayResponse response); boolean registerStatusAction(MStatus status, StatusAction action); Map<MStatus, List<StatusAction>> getAc... | StatusHandlerImpl implements StatusHandler { public boolean registerStatusAction(MStatus status, StatusAction action) { return actionRegister.get(status).add(action); } void handleStatus(GatewayResponse response); boolean registerStatusAction(MStatus status, StatusAction action); Map<MStatus, List<StatusAction>> getAc... |
@Test public void testSendPatientMessage() { System.out.println("sendPatientMessage"); String messageId = "tsid1"; String clinic = "Test clinic"; Date serviceDate = null; NameValuePair attrib = new NameValuePair("Test", "Test"); NameValuePair[] personalInfo = new NameValuePair[]{attrib}; String patientNumber = "0000000... | @WebMethod public MessageStatus sendPatientMessage(@WebParam(name = "messageId") String messageId, @WebParam(name = "personalInfo") NameValuePair[] personalInfo, @WebParam(name = "patientNumber") String patientNumber, @WebParam(name = "patientNumberType") ContactNumberType patientNumberType, @WebParam(name = "langCode"... | MessageServiceImpl implements MessageService { @WebMethod public MessageStatus sendPatientMessage(@WebParam(name = "messageId") String messageId, @WebParam(name = "personalInfo") NameValuePair[] personalInfo, @WebParam(name = "patientNumber") String patientNumber, @WebParam(name = "patientNumberType") ContactNumberType... | MessageServiceImpl implements MessageService { @WebMethod public MessageStatus sendPatientMessage(@WebParam(name = "messageId") String messageId, @WebParam(name = "personalInfo") NameValuePair[] personalInfo, @WebParam(name = "patientNumber") String patientNumber, @WebParam(name = "patientNumberType") ContactNumberType... | MessageServiceImpl implements MessageService { @WebMethod public MessageStatus sendPatientMessage(@WebParam(name = "messageId") String messageId, @WebParam(name = "personalInfo") NameValuePair[] personalInfo, @WebParam(name = "patientNumber") String patientNumber, @WebParam(name = "patientNumberType") ContactNumberType... | MessageServiceImpl implements MessageService { @WebMethod public MessageStatus sendPatientMessage(@WebParam(name = "messageId") String messageId, @WebParam(name = "personalInfo") NameValuePair[] personalInfo, @WebParam(name = "patientNumber") String patientNumber, @WebParam(name = "patientNumberType") ContactNumberType... |
@Test public void testSendCHPSMessage() { System.out.println("sendCHPSMessage"); String messageId = "tsid2"; String workerName = "Test worker"; String workerNumber = "000000000000"; MediaType messageType = MediaType.TEXT; Patient[] patientList = null; NameValuePair attrib = new NameValuePair("Test", "Test"); NameValueP... | @WebMethod public MessageStatus sendCHPSMessage(@WebParam(name = "messageId") String messageId, @WebParam(name = "personalInfo") NameValuePair[] personalInfo, @WebParam(name = "workerNumber") String workerNumber, @WebParam(name = "patientList") Patient[] patientList, @WebParam(name = "langCode") String langCode, @WebPa... | MessageServiceImpl implements MessageService { @WebMethod public MessageStatus sendCHPSMessage(@WebParam(name = "messageId") String messageId, @WebParam(name = "personalInfo") NameValuePair[] personalInfo, @WebParam(name = "workerNumber") String workerNumber, @WebParam(name = "patientList") Patient[] patientList, @WebP... | MessageServiceImpl implements MessageService { @WebMethod public MessageStatus sendCHPSMessage(@WebParam(name = "messageId") String messageId, @WebParam(name = "personalInfo") NameValuePair[] personalInfo, @WebParam(name = "workerNumber") String workerNumber, @WebParam(name = "patientList") Patient[] patientList, @WebP... | MessageServiceImpl implements MessageService { @WebMethod public MessageStatus sendCHPSMessage(@WebParam(name = "messageId") String messageId, @WebParam(name = "personalInfo") NameValuePair[] personalInfo, @WebParam(name = "workerNumber") String workerNumber, @WebParam(name = "patientList") Patient[] patientList, @WebP... | MessageServiceImpl implements MessageService { @WebMethod public MessageStatus sendCHPSMessage(@WebParam(name = "messageId") String messageId, @WebParam(name = "personalInfo") NameValuePair[] personalInfo, @WebParam(name = "workerNumber") String workerNumber, @WebParam(name = "patientList") Patient[] patientList, @WebP... |
@Test public void testSavePatientMessageRequest() { System.out.println("savePatientMessageRequest"); System.out.println("sendCHPSMessage"); String messageId = "tsid17"; String patientNumber = "000000000000"; List<Language> langList = new ArrayList<Language>(); langList.add(new LanguageImpl()); NameValuePair[] personalI... | public MessageStatus savePatientMessageRequest(String messageId, NameValuePair[] personalInfo, String patientNumber, ContactNumberType patientNumberType, String langCode, MediaType mediaType, Long notificationType, Date startDate, Date endDate, String recipientId) { logger.debug("Constructing MessageRequest object...")... | OMIServiceImpl implements OMIService { public MessageStatus savePatientMessageRequest(String messageId, NameValuePair[] personalInfo, String patientNumber, ContactNumberType patientNumberType, String langCode, MediaType mediaType, Long notificationType, Date startDate, Date endDate, String recipientId) { logger.debug("... | OMIServiceImpl implements OMIService { public MessageStatus savePatientMessageRequest(String messageId, NameValuePair[] personalInfo, String patientNumber, ContactNumberType patientNumberType, String langCode, MediaType mediaType, Long notificationType, Date startDate, Date endDate, String recipientId) { logger.debug("... | OMIServiceImpl implements OMIService { public MessageStatus savePatientMessageRequest(String messageId, NameValuePair[] personalInfo, String patientNumber, ContactNumberType patientNumberType, String langCode, MediaType mediaType, Long notificationType, Date startDate, Date endDate, String recipientId) { logger.debug("... | OMIServiceImpl implements OMIService { public MessageStatus savePatientMessageRequest(String messageId, NameValuePair[] personalInfo, String patientNumber, ContactNumberType patientNumberType, String langCode, MediaType mediaType, Long notificationType, Date startDate, Date endDate, String recipientId) { logger.debug("... |
@Test public void testSaveCHPSMessageRequest() { System.out.println("saveCHPSMessage"); String messageId = "tsid17"; String workerNumber = "000000000000"; Patient[] patientList = null; List<Language> langList = new ArrayList<Language>(); langList.add(new LanguageImpl()); NameValuePair[] personalInfo = new NameValuePair... | public MessageStatus saveCHPSMessageRequest(String messageId, NameValuePair[] personalInfo, String workerNumber, Patient[] patientList, String langCode, MediaType messageType, Long notificationType, Date startDate, Date endDate) { logger.info("Constructing MessageDetails object..."); if (workerNumber == null || workerN... | OMIServiceImpl implements OMIService { public MessageStatus saveCHPSMessageRequest(String messageId, NameValuePair[] personalInfo, String workerNumber, Patient[] patientList, String langCode, MediaType messageType, Long notificationType, Date startDate, Date endDate) { logger.info("Constructing MessageDetails object...... | OMIServiceImpl implements OMIService { public MessageStatus saveCHPSMessageRequest(String messageId, NameValuePair[] personalInfo, String workerNumber, Patient[] patientList, String langCode, MediaType messageType, Long notificationType, Date startDate, Date endDate) { logger.info("Constructing MessageDetails object...... | OMIServiceImpl implements OMIService { public MessageStatus saveCHPSMessageRequest(String messageId, NameValuePair[] personalInfo, String workerNumber, Patient[] patientList, String langCode, MediaType messageType, Long notificationType, Date startDate, Date endDate) { logger.info("Constructing MessageDetails object...... | OMIServiceImpl implements OMIService { public MessageStatus saveCHPSMessageRequest(String messageId, NameValuePair[] personalInfo, String workerNumber, Patient[] patientList, String langCode, MediaType messageType, Long notificationType, Date startDate, Date endDate) { logger.info("Constructing MessageDetails object...... |
@Test public void testSendMessage(){ System.out.println("sendMessage"); MessageRequest msgReq1 = new MessageRequestImpl(); msgReq1.setDateFrom(new Date()); msgReq1.setDateTo(new Date()); msgReq1.setId(19000000001l); msgReq1.setTryNumber(1); msgReq1.setMessageType(MessageType.TEXT); msgReq1.setRecipientName("Tester"); m... | public MessageStatus sendMessage(MessageRequest message) { if ((message.getRecipientNumber() == null || message.getRecipientNumber().isEmpty()) && !ContactNumberType.PUBLIC.toString().equals(message.getPhoneNumberType())) { return MessageStatus.REJECTED; } Language defaultLanguage = coreManager.createLanguageDAO().getB... | OMIServiceImpl implements OMIService { public MessageStatus sendMessage(MessageRequest message) { if ((message.getRecipientNumber() == null || message.getRecipientNumber().isEmpty()) && !ContactNumberType.PUBLIC.toString().equals(message.getPhoneNumberType())) { return MessageStatus.REJECTED; } Language defaultLanguage... | OMIServiceImpl implements OMIService { public MessageStatus sendMessage(MessageRequest message) { if ((message.getRecipientNumber() == null || message.getRecipientNumber().isEmpty()) && !ContactNumberType.PUBLIC.toString().equals(message.getPhoneNumberType())) { return MessageStatus.REJECTED; } Language defaultLanguage... | OMIServiceImpl implements OMIService { public MessageStatus sendMessage(MessageRequest message) { if ((message.getRecipientNumber() == null || message.getRecipientNumber().isEmpty()) && !ContactNumberType.PUBLIC.toString().equals(message.getPhoneNumberType())) { return MessageStatus.REJECTED; } Language defaultLanguage... | OMIServiceImpl implements OMIService { public MessageStatus sendMessage(MessageRequest message) { if ((message.getRecipientNumber() == null || message.getRecipientNumber().isEmpty()) && !ContactNumberType.PUBLIC.toString().equals(message.getPhoneNumberType())) { return MessageStatus.REJECTED; } Language defaultLanguage... |
@Test public void testProcessMessageRequests(){ System.out.println("processMessageRequests"); List<MessageRequest> messageList = new ArrayList<MessageRequest>(); MessageRequest msgReq1 = new MessageRequestImpl(); msgReq1.setDateFrom(new Date()); msgReq1.setDateTo(new Date()); msgReq1.setId(19000000002l); msgReq1.setTry... | @Transactional(readOnly = true) public void processMessageRequests() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgByStatus(MStatus.QUEUED); int numMsgs = (messages == null) ? 0 : messages.size(); logger.info("MessageRequest fetched: " + numMsgs);... | OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageRequests() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgByStatus(MStatus.QUEUED); int numMsgs = (messages == null) ? 0 : messages.size(); logger.info... | OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageRequests() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgByStatus(MStatus.QUEUED); int numMsgs = (messages == null) ? 0 : messages.size(); logger.info... | OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageRequests() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgByStatus(MStatus.QUEUED); int numMsgs = (messages == null) ? 0 : messages.size(); logger.info... | OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageRequests() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgByStatus(MStatus.QUEUED); int numMsgs = (messages == null) ? 0 : messages.size(); logger.info... |
@Test public void testProcessMessageRetries(){ System.out.println("processMessageRetries"); List<MessageRequest> messageList = new ArrayList<MessageRequest>(); MessageRequest msgReq1 = new MessageRequestImpl(); msgReq1.setDateFrom(new Date()); msgReq1.setDateTo(new Date()); msgReq1.setId(19000000003l); msgReq1.setTryNu... | @Transactional(readOnly = true) public void processMessageRetries() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgRequestByStatusAndTryNumber(MStatus.RETRY, maxTries); if (messages == null || messages.isEmpty()) { logger.info("No message request t... | OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageRetries() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgRequestByStatusAndTryNumber(MStatus.RETRY, maxTries); if (messages == null || messages.isEmpty... | OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageRetries() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgRequestByStatusAndTryNumber(MStatus.RETRY, maxTries); if (messages == null || messages.isEmpty... | OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageRetries() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgRequestByStatusAndTryNumber(MStatus.RETRY, maxTries); if (messages == null || messages.isEmpty... | OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageRetries() { MessageRequestDAO msgReqDao = coreManager.createMessageRequestDAO(); List<MessageRequest> messages = msgReqDao.getMsgRequestByStatusAndTryNumber(MStatus.RETRY, maxTries); if (messages == null || messages.isEmpty... |
@Test public void testCreateIncomingMessageParser() { System.out.println("createIncomingMessageParser"); IncomingMessageParser result = impManager.createIncomingMessageParser(); assertNotNull(result); } | public IncomingMessageParser createIncomingMessageParser(){ return (IncomingMessageParser)context.getBean("imParser"); } | IMPManagerImpl implements ApplicationContextAware, IMPManager { public IncomingMessageParser createIncomingMessageParser(){ return (IncomingMessageParser)context.getBean("imParser"); } } | IMPManagerImpl implements ApplicationContextAware, IMPManager { public IncomingMessageParser createIncomingMessageParser(){ return (IncomingMessageParser)context.getBean("imParser"); } } | IMPManagerImpl implements ApplicationContextAware, IMPManager { public IncomingMessageParser createIncomingMessageParser(){ return (IncomingMessageParser)context.getBean("imParser"); } IMPService createIMPService(); IncomingMessageParser createIncomingMessageParser(); IncomingMessageXMLParser createIncomingMessageXMLP... | IMPManagerImpl implements ApplicationContextAware, IMPManager { public IncomingMessageParser createIncomingMessageParser(){ return (IncomingMessageParser)context.getBean("imParser"); } IMPService createIMPService(); IncomingMessageParser createIncomingMessageParser(); IncomingMessageXMLParser createIncomingMessageXMLP... |
@Test public void testProcessMessageResponses(){ System.out.println("processMessageResponses"); List<MessageRequest> msgList = new ArrayList<MessageRequest>(); MessageRequestImpl request = new MessageRequestImpl(); request.setId(19000000005l); request.setStatus(MStatus.PENDING); msgList.add(request); GatewayRequest gwR... | @Transactional(readOnly = true) public void processMessageResponses() { GatewayResponseDAO gwRespDao = coreManager.createGatewayResponseDAO(); List<GatewayResponse> responses = gwRespDao.getByPendingMessageAndMaxTries(maxTries); if (responses == null || responses.isEmpty()) { logger.info("No updated gateway responses t... | OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageResponses() { GatewayResponseDAO gwRespDao = coreManager.createGatewayResponseDAO(); List<GatewayResponse> responses = gwRespDao.getByPendingMessageAndMaxTries(maxTries); if (responses == null || responses.isEmpty()) { logg... | OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageResponses() { GatewayResponseDAO gwRespDao = coreManager.createGatewayResponseDAO(); List<GatewayResponse> responses = gwRespDao.getByPendingMessageAndMaxTries(maxTries); if (responses == null || responses.isEmpty()) { logg... | OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageResponses() { GatewayResponseDAO gwRespDao = coreManager.createGatewayResponseDAO(); List<GatewayResponse> responses = gwRespDao.getByPendingMessageAndMaxTries(maxTries); if (responses == null || responses.isEmpty()) { logg... | OMIServiceImpl implements OMIService { @Transactional(readOnly = true) public void processMessageResponses() { GatewayResponseDAO gwRespDao = coreManager.createGatewayResponseDAO(); List<GatewayResponse> responses = gwRespDao.getByPendingMessageAndMaxTries(maxTries); if (responses == null || responses.isEmpty()) { logg... |
@Test public void shouldLogSaxParseExceptionWhenInvalidXMLContentIsPostedToServlet() throws Exception { String invalidXMLContent = "blahblahblah"; ResponseType expectedResponse = new ResponseType(); expectedResponse.setStatus(StatusType.ERROR); expectedResponse.setErrorCode(ErrorCodeType.MOTECH_MALFORMED_XML); mockRequ... | @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { String content = getContent(request); log.debug("Received: " + content); Object output = null; if ( !contentIsValid(content) ) { log.debug("Received invalid content"); AutoCreate ac = new ... | IntellIVRController extends AbstractController implements ResourceLoaderAware { @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { String content = getContent(request); log.debug("Received: " + content); Object output = null; if ( !content... | IntellIVRController extends AbstractController implements ResourceLoaderAware { @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { String content = getContent(request); log.debug("Received: " + content); Object output = null; if ( !content... | IntellIVRController extends AbstractController implements ResourceLoaderAware { @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { String content = getContent(request); log.debug("Received: " + content); Object output = null; if ( !content... | IntellIVRController extends AbstractController implements ResourceLoaderAware { @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { String content = getContent(request); log.debug("Received: " + content); Object output = null; if ( !content... |
@Test public void testParseMessageResponse() { System.out.println("parseMessageResponse"); GatewayRequest message = null; String gatewayResponse = ""; GatewayRequest expResult = null; Set<GatewayResponse> result = instance.parseMessageResponse(message, gatewayResponse); assertEquals(expResult, result); } | public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.trim().isEmpty()) return null; Set<GatewayResponse> responses = new HashSet<GatewayRespo... | ClickatellGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.trim().isEmpty())... | ClickatellGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.trim().isEmpty())... | ClickatellGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.trim().isEmpty())... | ClickatellGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.trim().isEmpty())... |
@Test public void testParseMessageStatus() { System.out.println("parseMessageStatus"); String messageStatus = ""; MStatus expResult = MStatus.RETRY; MStatus result = instance.parseMessageStatus(messageStatus); assertEquals(expResult, result); } | public MStatus parseMessageStatus(String gatewayResponse) { logger.debug("Parsing message gateway status response"); String status; String[] responseParts = gatewayResponse.split(" "); if(responseParts.length == 2){ status = responseParts[1]; } else if(responseParts.length == 4){ status = responseParts[3]; } else{ stat... | ClickatellGatewayMessageHandlerImpl implements GatewayMessageHandler { public MStatus parseMessageStatus(String gatewayResponse) { logger.debug("Parsing message gateway status response"); String status; String[] responseParts = gatewayResponse.split(" "); if(responseParts.length == 2){ status = responseParts[1]; } else... | ClickatellGatewayMessageHandlerImpl implements GatewayMessageHandler { public MStatus parseMessageStatus(String gatewayResponse) { logger.debug("Parsing message gateway status response"); String status; String[] responseParts = gatewayResponse.split(" "); if(responseParts.length == 2){ status = responseParts[1]; } else... | ClickatellGatewayMessageHandlerImpl implements GatewayMessageHandler { public MStatus parseMessageStatus(String gatewayResponse) { logger.debug("Parsing message gateway status response"); String status; String[] responseParts = gatewayResponse.split(" "); if(responseParts.length == 2){ status = responseParts[1]; } else... | ClickatellGatewayMessageHandlerImpl implements GatewayMessageHandler { public MStatus parseMessageStatus(String gatewayResponse) { logger.debug("Parsing message gateway status response"); String status; String[] responseParts = gatewayResponse.split(" "); if(responseParts.length == 2){ status = responseParts[1]; } else... |
@Test public void testSendMessage() { System.out.println("sendMessage"); GatewayRequest messageDetails = new GatewayRequestImpl(); messageDetails.setDateFrom(new Date()); messageDetails.setMessage("a message for testing"); messageDetails.setDateTo(new Date()); messageDetails.setRecipientsNumber("000000000000"); message... | public Set<GatewayResponse> sendMessage(GatewayRequest messageDetails) { try { postData = "api_id=" + URLEncoder.encode(apiId, "UTF-8"); postData += "&user=" + URLEncoder.encode(user, "UTF-8"); postData += "&password=" + URLEncoder.encode(password, "UTF-8"); postData += "&to=" + URLEncoder.encode(messageDetails.getReci... | ClickatellGatewayManagerImpl implements GatewayManager { public Set<GatewayResponse> sendMessage(GatewayRequest messageDetails) { try { postData = "api_id=" + URLEncoder.encode(apiId, "UTF-8"); postData += "&user=" + URLEncoder.encode(user, "UTF-8"); postData += "&password=" + URLEncoder.encode(password, "UTF-8"); post... | ClickatellGatewayManagerImpl implements GatewayManager { public Set<GatewayResponse> sendMessage(GatewayRequest messageDetails) { try { postData = "api_id=" + URLEncoder.encode(apiId, "UTF-8"); postData += "&user=" + URLEncoder.encode(user, "UTF-8"); postData += "&password=" + URLEncoder.encode(password, "UTF-8"); post... | ClickatellGatewayManagerImpl implements GatewayManager { public Set<GatewayResponse> sendMessage(GatewayRequest messageDetails) { try { postData = "api_id=" + URLEncoder.encode(apiId, "UTF-8"); postData += "&user=" + URLEncoder.encode(user, "UTF-8"); postData += "&password=" + URLEncoder.encode(password, "UTF-8"); post... | ClickatellGatewayManagerImpl implements GatewayManager { public Set<GatewayResponse> sendMessage(GatewayRequest messageDetails) { try { postData = "api_id=" + URLEncoder.encode(apiId, "UTF-8"); postData += "&user=" + URLEncoder.encode(user, "UTF-8"); postData += "&password=" + URLEncoder.encode(password, "UTF-8"); post... |
@Test public void testGetMessageStatus() { System.out.println("getMessageStatus"); GatewayResponseImpl response = new GatewayResponseImpl(); response.setGatewayMessageId("testId"); String result = instance.getMessageStatus(response); assertNotNull(result); } | public String getMessageStatus(GatewayResponse response) { try { postData = "api_id=" + URLEncoder.encode(apiId, "UTF-8"); postData += "&user=" + URLEncoder.encode(user, "UTF-8"); postData += "&password=" + URLEncoder.encode(password, "UTF-8"); postData += "&apimsgid=" + URLEncoder.encode(response.getGatewayMessageId()... | ClickatellGatewayManagerImpl implements GatewayManager { public String getMessageStatus(GatewayResponse response) { try { postData = "api_id=" + URLEncoder.encode(apiId, "UTF-8"); postData += "&user=" + URLEncoder.encode(user, "UTF-8"); postData += "&password=" + URLEncoder.encode(password, "UTF-8"); postData += "&apim... | ClickatellGatewayManagerImpl implements GatewayManager { public String getMessageStatus(GatewayResponse response) { try { postData = "api_id=" + URLEncoder.encode(apiId, "UTF-8"); postData += "&user=" + URLEncoder.encode(user, "UTF-8"); postData += "&password=" + URLEncoder.encode(password, "UTF-8"); postData += "&apim... | ClickatellGatewayManagerImpl implements GatewayManager { public String getMessageStatus(GatewayResponse response) { try { postData = "api_id=" + URLEncoder.encode(apiId, "UTF-8"); postData += "&user=" + URLEncoder.encode(user, "UTF-8"); postData += "&password=" + URLEncoder.encode(password, "UTF-8"); postData += "&apim... | ClickatellGatewayManagerImpl implements GatewayManager { public String getMessageStatus(GatewayResponse response) { try { postData = "api_id=" + URLEncoder.encode(apiId, "UTF-8"); postData += "&user=" + URLEncoder.encode(user, "UTF-8"); postData += "&password=" + URLEncoder.encode(password, "UTF-8"); postData += "&apim... |
@Test public void testMapMessageStatus() { System.out.println("mapMessageStatus"); GatewayResponseImpl response = new GatewayResponseImpl(); response.setResponseText("Some gateway response message"); expect( mockHandler.parseMessageStatus((String) anyObject()) ).andReturn(MStatus.DELIVERED); replay(mockHandler); MStatu... | public MStatus mapMessageStatus(GatewayResponse response) { return messageHandler.parseMessageStatus(response.getResponseText()); } | ClickatellGatewayManagerImpl implements GatewayManager { public MStatus mapMessageStatus(GatewayResponse response) { return messageHandler.parseMessageStatus(response.getResponseText()); } } | ClickatellGatewayManagerImpl implements GatewayManager { public MStatus mapMessageStatus(GatewayResponse response) { return messageHandler.parseMessageStatus(response.getResponseText()); } ClickatellGatewayManagerImpl(); } | ClickatellGatewayManagerImpl implements GatewayManager { public MStatus mapMessageStatus(GatewayResponse response) { return messageHandler.parseMessageStatus(response.getResponseText()); } ClickatellGatewayManagerImpl(); Set<GatewayResponse> sendMessage(GatewayRequest messageDetails); String getMessageStatus(GatewayRes... | ClickatellGatewayManagerImpl implements GatewayManager { public MStatus mapMessageStatus(GatewayResponse response) { return messageHandler.parseMessageStatus(response.getResponseText()); } ClickatellGatewayManagerImpl(); Set<GatewayResponse> sendMessage(GatewayRequest messageDetails); String getMessageStatus(GatewayRes... |
@Test public void shouldSetMessageStatusToSentWhenResponseMessageHasOk() { Set<GatewayResponse> responses = messageHandler.parseMessageResponse(gatewayRequest, "Status: Sent\nOK: " + recipientNumber); assertNotNull(responses); assertEquals(1, responses.size()); Iterator<GatewayResponse> iterator = responses.iterator();... | public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return null; Set<GatewayResponse> responses = new HashSet<GatewayResponse>();... | RancardGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return nu... | RancardGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return nu... | RancardGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return nu... | RancardGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return nu... |
@Test public void shouldSetMessageStatusToFailedWhenResponseMessageHasErrorWithCode() { Set<GatewayResponse> responses = messageHandler.parseMessageResponse(gatewayRequest, "Status: Retry Sending\nERROR: 111"); assertNotNull(responses); assertEquals(1, responses.size()); Iterator<GatewayResponse> iterator = responses.i... | public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return null; Set<GatewayResponse> responses = new HashSet<GatewayResponse>();... | RancardGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return nu... | RancardGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return nu... | RancardGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return nu... | RancardGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return nu... |
@Test public void shouldSetMessageStatusToRetryWhenResponseMessageHasErrorWithUnknownCode() { Set<GatewayResponse> responses = messageHandler.parseMessageResponse(gatewayRequest, "Status: Retry Sending\nERROR: Unknown"); assertNotNull(responses); assertEquals(1, responses.size()); Iterator<GatewayResponse> iterator = r... | public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return null; Set<GatewayResponse> responses = new HashSet<GatewayResponse>();... | RancardGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return nu... | RancardGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return nu... | RancardGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return nu... | RancardGatewayMessageHandlerImpl implements GatewayMessageHandler { public Set<GatewayResponse> parseMessageResponse(GatewayRequest message, String gatewayResponse) { logger.debug("Parsing message gateway response"); logger.debug(gatewayResponse); if(message == null) return null; if(gatewayResponse.isEmpty()) return nu... |
@Test public void testCreateIncomingMessageFormValidator() { System.out.println("createIncomingMessageFormValidator"); IncomingMessageFormValidator result = impManager.createIncomingMessageFormValidator(); assertNotNull(result); } | public IncomingMessageFormValidator createIncomingMessageFormValidator(){ return (IncomingMessageFormValidator)context.getBean("imFormValidator"); } | IMPManagerImpl implements ApplicationContextAware, IMPManager { public IncomingMessageFormValidator createIncomingMessageFormValidator(){ return (IncomingMessageFormValidator)context.getBean("imFormValidator"); } } | IMPManagerImpl implements ApplicationContextAware, IMPManager { public IncomingMessageFormValidator createIncomingMessageFormValidator(){ return (IncomingMessageFormValidator)context.getBean("imFormValidator"); } } | IMPManagerImpl implements ApplicationContextAware, IMPManager { public IncomingMessageFormValidator createIncomingMessageFormValidator(){ return (IncomingMessageFormValidator)context.getBean("imFormValidator"); } IMPService createIMPService(); IncomingMessageParser createIncomingMessageParser(); IncomingMessageXMLPars... | IMPManagerImpl implements ApplicationContextAware, IMPManager { public IncomingMessageFormValidator createIncomingMessageFormValidator(){ return (IncomingMessageFormValidator)context.getBean("imFormValidator"); } IMPService createIMPService(); IncomingMessageParser createIncomingMessageParser(); IncomingMessageXMLPars... |
@Test public void constructMe1() { assertNotNull(Instantiators .createInstantiator(ConstructMe1.class) .newInstance()); } | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test(expected = RuntimeException.class) public void objectWithMapOfIntToStringNoSpecificBindingWillFail() { Instantiators.createInstantiator(ObjectWithMapOfIntToString.class); } | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void objectWithListOfIntUsingInstances() { Instantiator<ObjectWithListOfInt> instantiator = createInstantiator( ObjectWithListOfInt.class, new AbstractInstantiatorModule() { @Override protected void configure() { registerFor(new TypeLiteral<List<Integer>>() {}) .converter(new ListOfIntConverter()); } }); c... | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void objectWithListOfIntUsingInstancesAndTypeScheme() { Instantiator<ObjectWithListOfInt> instantiator = createInstantiator( ObjectWithListOfInt.class, new AbstractInstantiatorModule() { @Override protected void configure() { registerFor(new TypeLiteral<List<? extends Integer>>() {}) .converter(new ListOfI... | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void objectWithListOfIntUsingBindings() { Instantiator<ObjectWithListOfInt> instantiator = createInstantiator( ObjectWithListOfInt.class, new AbstractInstantiatorModule() { @Override protected void configure() { registerFor(new TypeLiteral<List<Integer>>() {}) .converter(ListOfIntConverter.class); } }); ch... | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void objectWithListOfIntUsingBindingsAndTypeScheme() { Instantiator<ObjectWithListOfInt> instantiator = createInstantiator( ObjectWithListOfInt.class, new AbstractInstantiatorModule() { @Override protected void configure() { registerFor(new TypeLiteral<List<? extends Integer>>() {}) .converter(ListOfIntCon... | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void objectWithListOfIntAndListOfBooleanViaBindings() { Instantiator<ObjectWithListOfIntAndListOfBoolean> instantiator = createInstantiator( ObjectWithListOfIntAndListOfBoolean.class, new AbstractInstantiatorModule() { @Override protected void configure() { registerFor(new TypeLiteral<List<Integer>>() {}) ... | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void objectWithListOfIntAndListOfBooleanViaInstances() { Instantiator<ObjectWithListOfIntAndListOfBoolean> instantiator = createInstantiator( ObjectWithListOfIntAndListOfBoolean.class, new AbstractInstantiatorModule() { @Override protected void configure() { registerFor(new TypeLiteral<List<Integer>>() {})... | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void objectUsesValueWithConverterAsInnerClass() { Instantiator<ObjectUsesValueWithConverterAsInnerClass> instantiator = Instantiators .createInstantiator(ObjectUsesValueWithConverterAsInnerClass.class); ObjectUsesValueWithConverterAsInnerClass instance = instantiator .newInstance("5"); assertNotNull(instan... | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void localConstant() { Instantiator<LocalConstant> instantiator = Instantiators .createInstantiator(LocalConstant.class); LocalConstant instance = instantiator .newInstance((String) null); assertNotNull(instance); assertEquals(LocalConstant.MY_CONSTANT, instance.message); } | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void fullyQualifiedConstant() { Instantiator<FullyQualifiedConstant> instantiator = Instantiators .createInstantiator(FullyQualifiedConstant.class); FullyQualifiedConstant instance = instantiator .newInstance((String) null); assertNotNull(instance); assertEquals(LocalConstant.MY_CONSTANT, instance.message)... | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void constructMe2() { ConstructMe2 instance = Instantiators .createInstantiator(ConstructMe2.class) .newInstance("Jack Bauer"); assertNotNull(instance); assertEquals("Jack Bauer", instance.name); } | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void createUriConverter() throws URISyntaxException { assertEquals( new URI("www.kaching.com"), createConverter(URI.class).fromString("www.kaching.com")); } | public static <T> Converter<T> createConverter( Class<T> klass, InstantiatorModule... modules) { return createConverterForType(klass, modules); } | Instantiators { public static <T> Converter<T> createConverter( Class<T> klass, InstantiatorModule... modules) { return createConverterForType(klass, modules); } } | Instantiators { public static <T> Converter<T> createConverter( Class<T> klass, InstantiatorModule... modules) { return createConverterForType(klass, modules); } private Instantiators(); } | Instantiators { public static <T> Converter<T> createConverter( Class<T> klass, InstantiatorModule... modules) { return createConverterForType(klass, modules); } private Instantiators(); static Instantiator<T> createInstantiator(
Class<T> klass, InstantiatorModule... modules); @SuppressWarnings({ "unchecked", "r... | Instantiators { public static <T> Converter<T> createConverter( Class<T> klass, InstantiatorModule... modules) { return createConverterForType(klass, modules); } private Instantiators(); static Instantiator<T> createInstantiator(
Class<T> klass, InstantiatorModule... modules); @SuppressWarnings({ "unchecked", "r... |
@Test public void optionalStringWithEmptyStringAsDefault() { assertEquals( "", createInstantiator(OptionalStringWithEmptyStringAsDefault.class).newInstance((String) null).name); } | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void createConverterPairConverter() throws URISyntaxException { Converter<ConvertedPair> converter = createConverter(ConvertedPair.class); assertEquals( "1:2", converter.toString(converter.fromString("1:2"))); } | public static <T> Converter<T> createConverter( Class<T> klass, InstantiatorModule... modules) { return createConverterForType(klass, modules); } | Instantiators { public static <T> Converter<T> createConverter( Class<T> klass, InstantiatorModule... modules) { return createConverterForType(klass, modules); } } | Instantiators { public static <T> Converter<T> createConverter( Class<T> klass, InstantiatorModule... modules) { return createConverterForType(klass, modules); } private Instantiators(); } | Instantiators { public static <T> Converter<T> createConverter( Class<T> klass, InstantiatorModule... modules) { return createConverterForType(klass, modules); } private Instantiators(); static Instantiator<T> createInstantiator(
Class<T> klass, InstantiatorModule... modules); @SuppressWarnings({ "unchecked", "r... | Instantiators { public static <T> Converter<T> createConverter( Class<T> klass, InstantiatorModule... modules) { return createConverterForType(klass, modules); } private Instantiators(); static Instantiator<T> createInstantiator(
Class<T> klass, InstantiatorModule... modules); @SuppressWarnings({ "unchecked", "r... |
@Test public void properlyBubblesException() { try { converter(TakesSingleStringAndThrows.class).fromString(null); fail(); } catch (RuntimeException e) { assertEquals(PrivateLocalRuntimException.class, e.getClass()); } } | @Override @SuppressWarnings("unchecked") public T fromString(String representation) { try { constructor.setAccessible(true); return (T) constructor.newInstance(representation); } catch (IllegalArgumentException e) { throw new IllegalStateException( "unreachable since we check the number of arguments the " + "constructo... | StringConstructorConverter implements Converter<T> { @Override @SuppressWarnings("unchecked") public T fromString(String representation) { try { constructor.setAccessible(true); return (T) constructor.newInstance(representation); } catch (IllegalArgumentException e) { throw new IllegalStateException( "unreachable since... | StringConstructorConverter implements Converter<T> { @Override @SuppressWarnings("unchecked") public T fromString(String representation) { try { constructor.setAccessible(true); return (T) constructor.newInstance(representation); } catch (IllegalArgumentException e) { throw new IllegalStateException( "unreachable since... | StringConstructorConverter implements Converter<T> { @Override @SuppressWarnings("unchecked") public T fromString(String representation) { try { constructor.setAccessible(true); return (T) constructor.newInstance(representation); } catch (IllegalArgumentException e) { throw new IllegalStateException( "unreachable since... | StringConstructorConverter implements Converter<T> { @Override @SuppressWarnings("unchecked") public T fromString(String representation) { try { constructor.setAccessible(true); return (T) constructor.newInstance(representation); } catch (IllegalArgumentException e) { throw new IllegalStateException( "unreachable since... |
@Test public void fromInstanceSimple() { assertEquals( newArrayList("56"), createFactory(new Errors(), Simple.class).build().getOrThrow() .fromInstance(new Simple(56))); } | @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Object value = field.get(instance); if (wrapInOpt... | InstantiatorImpl implements Instantiator<T> { @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Obj... | InstantiatorImpl implements Instantiator<T> { @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Obj... | InstantiatorImpl implements Instantiator<T> { @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Obj... | InstantiatorImpl implements Instantiator<T> { @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Obj... |
@Test public void newInstanceHasEnum() { assertEquals( IsEnum.FOO, createFactory(new Errors(), HasEnum.class).build().getOrThrow() .newInstance("FOO") .value); } | @Override public T newInstance(String... values) { return newInstance(Arrays.asList(values)); } | InstantiatorImpl implements Instantiator<T> { @Override public T newInstance(String... values) { return newInstance(Arrays.asList(values)); } } | InstantiatorImpl implements Instantiator<T> { @Override public T newInstance(String... values) { return newInstance(Arrays.asList(values)); } InstantiatorImpl(
Constructor<T> constructor,
Converter<?>[] converters,
Field[] fields,
BitSet optionality,
BitSet wrapInOption,
String[] def... | InstantiatorImpl implements Instantiator<T> { @Override public T newInstance(String... values) { return newInstance(Arrays.asList(values)); } InstantiatorImpl(
Constructor<T> constructor,
Converter<?>[] converters,
Field[] fields,
BitSet optionality,
BitSet wrapInOption,
String[] def... | InstantiatorImpl implements Instantiator<T> { @Override public T newInstance(String... values) { return newInstance(Arrays.asList(values)); } InstantiatorImpl(
Constructor<T> constructor,
Converter<?>[] converters,
Field[] fields,
BitSet optionality,
BitSet wrapInOption,
String[] def... |
@Test public void fromInstanceHasEnum() { assertEquals( newArrayList("FOO"), createFactory(new Errors(), HasEnum.class).build().getOrThrow() .fromInstance(new HasEnum(IsEnum.FOO))); } | @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Object value = field.get(instance); if (wrapInOpt... | InstantiatorImpl implements Instantiator<T> { @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Obj... | InstantiatorImpl implements Instantiator<T> { @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Obj... | InstantiatorImpl implements Instantiator<T> { @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Obj... | InstantiatorImpl implements Instantiator<T> { @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Obj... |
@Test public void fromInstanceNatives() { List<String> parameters = createFactory(new Errors(), Natives.class).build().getOrThrow() .fromInstance(new Natives(2, 3.4, (short) 5, '6', 7l, true, 8.0f, (byte) 9)); assertEquals( newArrayList( "2", "3.4", "5", "6", "7", "true", "8.0", "9"), parameters); } | @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Object value = field.get(instance); if (wrapInOpt... | InstantiatorImpl implements Instantiator<T> { @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Obj... | InstantiatorImpl implements Instantiator<T> { @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Obj... | InstantiatorImpl implements Instantiator<T> { @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Obj... | InstantiatorImpl implements Instantiator<T> { @SuppressWarnings("unchecked") public List<String> fromInstance(T instance) { List<String> parameters = Lists.newArrayListWithCapacity(fields.length); for (int i = 0; i < fields.length; i++) { try { Field field = fields[i]; String parameterAsString; if (field != null) { Obj... |
@Test public void getConstructor() throws Exception { Constructor<Object> constructor = Object.class.getConstructor(); InstantiatorImpl<Object> instantiator = new InstantiatorImpl<Object>( constructor, null, null, new BitSet(), new BitSet(), null, null, null); assertTrue(constructor == instantiator.getConstructor()); } | @Override public Constructor<T> getConstructor() { return constructor; } | InstantiatorImpl implements Instantiator<T> { @Override public Constructor<T> getConstructor() { return constructor; } } | InstantiatorImpl implements Instantiator<T> { @Override public Constructor<T> getConstructor() { return constructor; } InstantiatorImpl(
Constructor<T> constructor,
Converter<?>[] converters,
Field[] fields,
BitSet optionality,
BitSet wrapInOption,
String[] defaultValues,
Objec... | InstantiatorImpl implements Instantiator<T> { @Override public Constructor<T> getConstructor() { return constructor; } InstantiatorImpl(
Constructor<T> constructor,
Converter<?>[] converters,
Field[] fields,
BitSet optionality,
BitSet wrapInOption,
String[] defaultValues,
Objec... | InstantiatorImpl implements Instantiator<T> { @Override public Constructor<T> getConstructor() { return constructor; } InstantiatorImpl(
Constructor<T> constructor,
Converter<?>[] converters,
Field[] fields,
BitSet optionality,
BitSet wrapInOption,
String[] defaultValues,
Objec... |
@Test(expected = UnsupportedOperationException.class) public void fromInstanceByNameThrowsIfNoParamaterNames() throws Exception { InstantiatorImpl<String> instantiator = new InstantiatorImpl<String>( null, null, null, null, null, null, null, null); instantiator.newInstance((Map<String, String>) null); } | @Override public T newInstance(String... values) { return newInstance(Arrays.asList(values)); } | InstantiatorImpl implements Instantiator<T> { @Override public T newInstance(String... values) { return newInstance(Arrays.asList(values)); } } | InstantiatorImpl implements Instantiator<T> { @Override public T newInstance(String... values) { return newInstance(Arrays.asList(values)); } InstantiatorImpl(
Constructor<T> constructor,
Converter<?>[] converters,
Field[] fields,
BitSet optionality,
BitSet wrapInOption,
String[] def... | InstantiatorImpl implements Instantiator<T> { @Override public T newInstance(String... values) { return newInstance(Arrays.asList(values)); } InstantiatorImpl(
Constructor<T> constructor,
Converter<?>[] converters,
Field[] fields,
BitSet optionality,
BitSet wrapInOption,
String[] def... | InstantiatorImpl implements Instantiator<T> { @Override public T newInstance(String... values) { return newInstance(Arrays.asList(values)); } InstantiatorImpl(
Constructor<T> constructor,
Converter<?>[] converters,
Field[] fields,
BitSet optionality,
BitSet wrapInOption,
String[] def... |
@Test public void constructMe2ByName() { ConstructMe2 instance = Instantiators .createInstantiator(ConstructMe2.class) .newInstance(ImmutableMap.of("name", "Jack Bauer")); assertNotNull(instance); assertEquals("Jack Bauer", instance.name); } | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test @SuppressWarnings({ "unchecked", "rawtypes" }) public void createsRightKindOfCollection() { assertEquals( HashSet.class, new CollectionOfElementsConverter(Set.class, C_BOOLEAN).fromString("").getClass()); } | @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public T fromString(String representation) { if (representation == null) { return null; } else { Collection collection = collectionProvider.get(); if (!representation.isEmpty()) { for (String part : representation.split(",")) { collection.add(elementConverter.fro... | CollectionOfElementsConverter implements Converter<T> { @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public T fromString(String representation) { if (representation == null) { return null; } else { Collection collection = collectionProvider.get(); if (!representation.isEmpty()) { for (String part : represen... | CollectionOfElementsConverter implements Converter<T> { @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public T fromString(String representation) { if (representation == null) { return null; } else { Collection collection = collectionProvider.get(); if (!representation.isEmpty()) { for (String part : represen... | CollectionOfElementsConverter implements Converter<T> { @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public T fromString(String representation) { if (representation == null) { return null; } else { Collection collection = collectionProvider.get(); if (!representation.isEmpty()) { for (String part : represen... | CollectionOfElementsConverter implements Converter<T> { @Override @SuppressWarnings({ "unchecked", "rawtypes" }) public T fromString(String representation) { if (representation == null) { return null; } else { Collection collection = collectionProvider.get(); if (!representation.isEmpty()) { for (String part : represen... |
@Test public void regression1() throws IOException { InputStream classInputStream = this.getClass().getResourceAsStream("example_scala_class01.bin"); assertNotNull(classInputStream); Map<String, FormalParameter> assignements = analyse(classInputStream, "com/kaching/trading/rules/formula/FormulaValue", "java/lang/Object... | static AnalysisResult analyse( Class<?> klass, Constructor<?> constructor) throws IOException { Class<?>[] parameterTypes = constructor.getParameterTypes(); InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class"); if (in == null) { throw new IllegalArgumentException(format("can no... | ConstructorAnalysis { static AnalysisResult analyse( Class<?> klass, Constructor<?> constructor) throws IOException { Class<?>[] parameterTypes = constructor.getParameterTypes(); InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class"); if (in == null) { throw new IllegalArgumentEx... | ConstructorAnalysis { static AnalysisResult analyse( Class<?> klass, Constructor<?> constructor) throws IOException { Class<?>[] parameterTypes = constructor.getParameterTypes(); InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class"); if (in == null) { throw new IllegalArgumentEx... | ConstructorAnalysis { static AnalysisResult analyse( Class<?> klass, Constructor<?> constructor) throws IOException { Class<?>[] parameterTypes = constructor.getParameterTypes(); InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class"); if (in == null) { throw new IllegalArgumentEx... | ConstructorAnalysis { static AnalysisResult analyse( Class<?> klass, Constructor<?> constructor) throws IOException { Class<?>[] parameterTypes = constructor.getParameterTypes(); InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class"); if (in == null) { throw new IllegalArgumentEx... |
@Test public void regression2() throws IOException { InputStream classInputStream = this.getClass().getResourceAsStream("example_scala_class02.bin"); assertNotNull(classInputStream); Map<String, FormalParameter> assignements = analyse(classInputStream, "com/kaching/user/GetAllModels", "com/kaching/platform/queryengine/... | static AnalysisResult analyse( Class<?> klass, Constructor<?> constructor) throws IOException { Class<?>[] parameterTypes = constructor.getParameterTypes(); InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class"); if (in == null) { throw new IllegalArgumentException(format("can no... | ConstructorAnalysis { static AnalysisResult analyse( Class<?> klass, Constructor<?> constructor) throws IOException { Class<?>[] parameterTypes = constructor.getParameterTypes(); InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class"); if (in == null) { throw new IllegalArgumentEx... | ConstructorAnalysis { static AnalysisResult analyse( Class<?> klass, Constructor<?> constructor) throws IOException { Class<?>[] parameterTypes = constructor.getParameterTypes(); InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class"); if (in == null) { throw new IllegalArgumentEx... | ConstructorAnalysis { static AnalysisResult analyse( Class<?> klass, Constructor<?> constructor) throws IOException { Class<?>[] parameterTypes = constructor.getParameterTypes(); InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class"); if (in == null) { throw new IllegalArgumentEx... | ConstructorAnalysis { static AnalysisResult analyse( Class<?> klass, Constructor<?> constructor) throws IOException { Class<?>[] parameterTypes = constructor.getParameterTypes(); InputStream in = klass.getResourceAsStream("/" + klass.getName().replace('.', '/') + ".class"); if (in == null) { throw new IllegalArgumentEx... |
@Test public void fromNullString() throws Exception { Converter<Boolean> converter = new NullHandlingConverter<Boolean>() { @Override protected Boolean fromNonNullableString(String representation) { throw new UnsupportedOperationException(); } @Override protected String nonNullableToString(Boolean value) { throw new Un... | public T fromString(String representation) { return representation == null ? null : fromNonNullableString(representation); } | NullHandlingConverter implements Converter<T> { public T fromString(String representation) { return representation == null ? null : fromNonNullableString(representation); } } | NullHandlingConverter implements Converter<T> { public T fromString(String representation) { return representation == null ? null : fromNonNullableString(representation); } } | NullHandlingConverter implements Converter<T> { public T fromString(String representation) { return representation == null ? null : fromNonNullableString(representation); } T fromString(String representation); String toString(T value); } | NullHandlingConverter implements Converter<T> { public T fromString(String representation) { return representation == null ? null : fromNonNullableString(representation); } T fromString(String representation); String toString(T value); } |
@Test public void fromNotNullString() throws Exception { Converter<Boolean> converter = new NullHandlingConverter<Boolean>() { @Override protected Boolean fromNonNullableString(String representation) { return true; } @Override protected String nonNullableToString(Boolean value) { throw new UnsupportedOperationException... | public T fromString(String representation) { return representation == null ? null : fromNonNullableString(representation); } | NullHandlingConverter implements Converter<T> { public T fromString(String representation) { return representation == null ? null : fromNonNullableString(representation); } } | NullHandlingConverter implements Converter<T> { public T fromString(String representation) { return representation == null ? null : fromNonNullableString(representation); } } | NullHandlingConverter implements Converter<T> { public T fromString(String representation) { return representation == null ? null : fromNonNullableString(representation); } T fromString(String representation); String toString(T value); } | NullHandlingConverter implements Converter<T> { public T fromString(String representation) { return representation == null ? null : fromNonNullableString(representation); } T fromString(String representation); String toString(T value); } |
@Test public void nullToString() throws Exception { Converter<Boolean> converter = new NullHandlingConverter<Boolean>() { @Override protected Boolean fromNonNullableString(String representation) { throw new UnsupportedOperationException(); } @Override protected String nonNullableToString(Boolean value) { throw new Unsu... | public String toString(T value) { return value == null ? null : nonNullableToString(value); } | NullHandlingConverter implements Converter<T> { public String toString(T value) { return value == null ? null : nonNullableToString(value); } } | NullHandlingConverter implements Converter<T> { public String toString(T value) { return value == null ? null : nonNullableToString(value); } } | NullHandlingConverter implements Converter<T> { public String toString(T value) { return value == null ? null : nonNullableToString(value); } T fromString(String representation); String toString(T value); } | NullHandlingConverter implements Converter<T> { public String toString(T value) { return value == null ? null : nonNullableToString(value); } T fromString(String representation); String toString(T value); } |
@Test public void notNullToString() throws Exception { Converter<Boolean> converter = new NullHandlingConverter<Boolean>() { @Override protected Boolean fromNonNullableString(String representation) { throw new UnsupportedOperationException(); } @Override protected String nonNullableToString(Boolean value) { return ""; ... | public String toString(T value) { return value == null ? null : nonNullableToString(value); } | NullHandlingConverter implements Converter<T> { public String toString(T value) { return value == null ? null : nonNullableToString(value); } } | NullHandlingConverter implements Converter<T> { public String toString(T value) { return value == null ? null : nonNullableToString(value); } } | NullHandlingConverter implements Converter<T> { public String toString(T value) { return value == null ? null : nonNullableToString(value); } T fromString(String representation); String toString(T value); } | NullHandlingConverter implements Converter<T> { public String toString(T value) { return value == null ? null : nonNullableToString(value); } T fromString(String representation); String toString(T value); } |
@Test public void incorrectBoundForConverter() { check( "the converter interface com.kaching.platform.converters.Converter, " + "mentioned on class java.lang.String using @ConvertedBy, " + "does not produce instances of class java.lang.String. It produces " + "class java.lang.Integer.", InstantiatorErrors.incorrectBoun... | @SuppressWarnings("rawtypes") static Errors incorrectBoundForConverter( Errors errors, Type targetType, Class<? extends Converter> converterClass, Type producedType) { return errors.addMessage( "the converter %2$s, mentioned on %1$s using @%4$s, does not produce " + "instances of %1$s. It produces %3$s.", targetType, c... | InstantiatorErrors { @SuppressWarnings("rawtypes") static Errors incorrectBoundForConverter( Errors errors, Type targetType, Class<? extends Converter> converterClass, Type producedType) { return errors.addMessage( "the converter %2$s, mentioned on %1$s using @%4$s, does not produce " + "instances of %1$s. It produces ... | InstantiatorErrors { @SuppressWarnings("rawtypes") static Errors incorrectBoundForConverter( Errors errors, Type targetType, Class<? extends Converter> converterClass, Type producedType) { return errors.addMessage( "the converter %2$s, mentioned on %1$s using @%4$s, does not produce " + "instances of %1$s. It produces ... | InstantiatorErrors { @SuppressWarnings("rawtypes") static Errors incorrectBoundForConverter( Errors errors, Type targetType, Class<? extends Converter> converterClass, Type producedType) { return errors.addMessage( "the converter %2$s, mentioned on %1$s using @%4$s, does not produce " + "instances of %1$s. It produces ... | InstantiatorErrors { @SuppressWarnings("rawtypes") static Errors incorrectBoundForConverter( Errors errors, Type targetType, Class<? extends Converter> converterClass, Type producedType) { return errors.addMessage( "the converter %2$s, mentioned on %1$s using @%4$s, does not produce " + "instances of %1$s. It produces ... |
@Test public void incorrectDefaultValue() { check( "java.lang.NumberFormatException: For default value \"90z\"", InstantiatorErrors.incorrectDefaultValue( new Errors(), "90z", new NumberFormatException("the message"))); } | static Errors incorrectDefaultValue(Errors errors, String value, RuntimeException e) { return errors.addMessage( "%s: For default value \"%s\"", e.getClass().getName(), value); } | InstantiatorErrors { static Errors incorrectDefaultValue(Errors errors, String value, RuntimeException e) { return errors.addMessage( "%s: For default value \"%s\"", e.getClass().getName(), value); } } | InstantiatorErrors { static Errors incorrectDefaultValue(Errors errors, String value, RuntimeException e) { return errors.addMessage( "%s: For default value \"%s\"", e.getClass().getName(), value); } } | InstantiatorErrors { static Errors incorrectDefaultValue(Errors errors, String value, RuntimeException e) { return errors.addMessage( "%s: For default value \"%s\"", e.getClass().getName(), value); } } | InstantiatorErrors { static Errors incorrectDefaultValue(Errors errors, String value, RuntimeException e) { return errors.addMessage( "%s: For default value \"%s\"", e.getClass().getName(), value); } } |
@Test public void illegalConstructor1() { check( "class java.lang.String has an illegal constructor: hello", InstantiatorErrors.illegalConstructor( new Errors(), String.class, "hello")); } | static Errors illegalConstructor(Errors errors, Class<?> klass, String message) { return errors.addMessage( "%s has an illegal constructor%s", klass, message == null ? "" : ": " + message); } | InstantiatorErrors { static Errors illegalConstructor(Errors errors, Class<?> klass, String message) { return errors.addMessage( "%s has an illegal constructor%s", klass, message == null ? "" : ": " + message); } } | InstantiatorErrors { static Errors illegalConstructor(Errors errors, Class<?> klass, String message) { return errors.addMessage( "%s has an illegal constructor%s", klass, message == null ? "" : ": " + message); } } | InstantiatorErrors { static Errors illegalConstructor(Errors errors, Class<?> klass, String message) { return errors.addMessage( "%s has an illegal constructor%s", klass, message == null ? "" : ": " + message); } } | InstantiatorErrors { static Errors illegalConstructor(Errors errors, Class<?> klass, String message) { return errors.addMessage( "%s has an illegal constructor%s", klass, message == null ? "" : ": " + message); } } |
@Test public void constructMe3() { Instantiator<ConstructMe3> instantiator = Instantiators .createInstantiator(ConstructMe3.class); ConstructMe3 instance = instantiator .newInstance("Jack Bauer", "First:Last"); assertNotNull(instance); assertEquals("Jack Bauer", instance.name.content); assertEquals("First", instance.pa... | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void illegalConstructor2() { check( "class java.lang.String has an illegal constructor", InstantiatorErrors.illegalConstructor( new Errors(), String.class, null)); } | static Errors illegalConstructor(Errors errors, Class<?> klass, String message) { return errors.addMessage( "%s has an illegal constructor%s", klass, message == null ? "" : ": " + message); } | InstantiatorErrors { static Errors illegalConstructor(Errors errors, Class<?> klass, String message) { return errors.addMessage( "%s has an illegal constructor%s", klass, message == null ? "" : ": " + message); } } | InstantiatorErrors { static Errors illegalConstructor(Errors errors, Class<?> klass, String message) { return errors.addMessage( "%s has an illegal constructor%s", klass, message == null ? "" : ": " + message); } } | InstantiatorErrors { static Errors illegalConstructor(Errors errors, Class<?> klass, String message) { return errors.addMessage( "%s has an illegal constructor%s", klass, message == null ? "" : ": " + message); } } | InstantiatorErrors { static Errors illegalConstructor(Errors errors, Class<?> klass, String message) { return errors.addMessage( "%s has an illegal constructor%s", klass, message == null ? "" : ": " + message); } } |
@Test public void enumHasAmbiguousNames() { check( "enum com.kaching.platform.converters.InstantiatorErrorsTest$AmbiguousEnum has ambiguous names", InstantiatorErrors.enumHasAmbiguousNames( new Errors(), AmbiguousEnum.class)); } | static Errors enumHasAmbiguousNames(Errors errors, Class<? extends Enum<?>> clazz) { return errors.addMessage( "enum %s has ambiguous names", clazz.getName()); } | InstantiatorErrors { static Errors enumHasAmbiguousNames(Errors errors, Class<? extends Enum<?>> clazz) { return errors.addMessage( "enum %s has ambiguous names", clazz.getName()); } } | InstantiatorErrors { static Errors enumHasAmbiguousNames(Errors errors, Class<? extends Enum<?>> clazz) { return errors.addMessage( "enum %s has ambiguous names", clazz.getName()); } } | InstantiatorErrors { static Errors enumHasAmbiguousNames(Errors errors, Class<? extends Enum<?>> clazz) { return errors.addMessage( "enum %s has ambiguous names", clazz.getName()); } } | InstantiatorErrors { static Errors enumHasAmbiguousNames(Errors errors, Class<? extends Enum<?>> clazz) { return errors.addMessage( "enum %s has ambiguous names", clazz.getName()); } } |
@Test public void moreThanOneMatchingFunction() { check( "class com.kaching.platform.converters.InstantiatorErrorsTest$AmbiguousEnum has more than one matching function", InstantiatorErrors.moreThanOneMatchingFunction( new Errors(), AmbiguousEnum.class)); } | static Errors moreThanOneMatchingFunction(Errors errors, Type type) { return errors.addMessage( "%s has more than one matching function", type); } | InstantiatorErrors { static Errors moreThanOneMatchingFunction(Errors errors, Type type) { return errors.addMessage( "%s has more than one matching function", type); } } | InstantiatorErrors { static Errors moreThanOneMatchingFunction(Errors errors, Type type) { return errors.addMessage( "%s has more than one matching function", type); } } | InstantiatorErrors { static Errors moreThanOneMatchingFunction(Errors errors, Type type) { return errors.addMessage( "%s has more than one matching function", type); } } | InstantiatorErrors { static Errors moreThanOneMatchingFunction(Errors errors, Type type) { return errors.addMessage( "%s has more than one matching function", type); } } |
@Test public void noConverterForType() { check( "no converter for java.util.List<java.lang.String>", InstantiatorErrors.noConverterForType( new Errors(), new TypeLiteral<List<String>>() {}.getType())); } | static Errors noConverterForType(Errors errors, Type type) { return errors.addMessage( "no converter for %s", type); } | InstantiatorErrors { static Errors noConverterForType(Errors errors, Type type) { return errors.addMessage( "no converter for %s", type); } } | InstantiatorErrors { static Errors noConverterForType(Errors errors, Type type) { return errors.addMessage( "no converter for %s", type); } } | InstantiatorErrors { static Errors noConverterForType(Errors errors, Type type) { return errors.addMessage( "no converter for %s", type); } } | InstantiatorErrors { static Errors noConverterForType(Errors errors, Type type) { return errors.addMessage( "no converter for %s", type); } } |
@Test public void addinTwiceTheSameMessageDoesNotDuplicateTheError() { check( "no such field a", noSuchField(noSuchField(new Errors(), "a"), "a")); } | static Errors noSuchField(Errors errors, String fieldName) { return errors.addMessage( "no such field %s", fieldName); } | InstantiatorErrors { static Errors noSuchField(Errors errors, String fieldName) { return errors.addMessage( "no such field %s", fieldName); } } | InstantiatorErrors { static Errors noSuchField(Errors errors, String fieldName) { return errors.addMessage( "no such field %s", fieldName); } } | InstantiatorErrors { static Errors noSuchField(Errors errors, String fieldName) { return errors.addMessage( "no such field %s", fieldName); } } | InstantiatorErrors { static Errors noSuchField(Errors errors, String fieldName) { return errors.addMessage( "no such field %s", fieldName); } } |
@Test public void cannotSpecifyDefaultValueAndConstant() throws Exception { check( "cannot specify both a default constant and a default value " + "@Optional(constant=FOO, value=4)", InstantiatorErrors.cannotSpecifyDefaultValueAndConstant( new Errors(), inspectMeCannotSpecifyDefaultValueAndConstant(8))); } | static Errors cannotSpecifyDefaultValueAndConstant(Errors errors, Optional annotation) { return errors.addMessage( "cannot specify both a default constant and a default value %s", annotation.toString().replaceFirst(Optional.class.getName(), Optional.class.getSimpleName())); } | InstantiatorErrors { static Errors cannotSpecifyDefaultValueAndConstant(Errors errors, Optional annotation) { return errors.addMessage( "cannot specify both a default constant and a default value %s", annotation.toString().replaceFirst(Optional.class.getName(), Optional.class.getSimpleName())); } } | InstantiatorErrors { static Errors cannotSpecifyDefaultValueAndConstant(Errors errors, Optional annotation) { return errors.addMessage( "cannot specify both a default constant and a default value %s", annotation.toString().replaceFirst(Optional.class.getName(), Optional.class.getSimpleName())); } } | InstantiatorErrors { static Errors cannotSpecifyDefaultValueAndConstant(Errors errors, Optional annotation) { return errors.addMessage( "cannot specify both a default constant and a default value %s", annotation.toString().replaceFirst(Optional.class.getName(), Optional.class.getSimpleName())); } } | InstantiatorErrors { static Errors cannotSpecifyDefaultValueAndConstant(Errors errors, Optional annotation) { return errors.addMessage( "cannot specify both a default constant and a default value %s", annotation.toString().replaceFirst(Optional.class.getName(), Optional.class.getSimpleName())); } } |
@Test public void unableToResolveLocalConstant() throws Exception { check( "unable to resolve constant com.kaching.platform.converters.InstantiatorErrorsTest#MY_CONSTANT", InstantiatorErrors.unableToResolveConstant( new Errors(), InstantiatorErrorsTest.class, "MY_CONSTANT")); } | static Errors unableToResolveConstant(Errors errors, Class<?> container, String constant) { return unableToResolveFullyQualifiedConstant( errors, localConstantQualifier(container, constant)); } | InstantiatorErrors { static Errors unableToResolveConstant(Errors errors, Class<?> container, String constant) { return unableToResolveFullyQualifiedConstant( errors, localConstantQualifier(container, constant)); } } | InstantiatorErrors { static Errors unableToResolveConstant(Errors errors, Class<?> container, String constant) { return unableToResolveFullyQualifiedConstant( errors, localConstantQualifier(container, constant)); } } | InstantiatorErrors { static Errors unableToResolveConstant(Errors errors, Class<?> container, String constant) { return unableToResolveFullyQualifiedConstant( errors, localConstantQualifier(container, constant)); } } | InstantiatorErrors { static Errors unableToResolveConstant(Errors errors, Class<?> container, String constant) { return unableToResolveFullyQualifiedConstant( errors, localConstantQualifier(container, constant)); } } |
@Test public void assemble() { assertEquals(serializable, type.assemble(serializable, null)); assertEquals(serializable, type.assemble(serializable, null, null)); } | public Object assemble( Serializable cached, SessionImplementor session, Object owner) throws HibernateException { return cached; } | AbstractImmutableType extends AbstractType { public Object assemble( Serializable cached, SessionImplementor session, Object owner) throws HibernateException { return cached; } } | AbstractImmutableType extends AbstractType { public Object assemble( Serializable cached, SessionImplementor session, Object owner) throws HibernateException { return cached; } } | AbstractImmutableType extends AbstractType { public Object assemble( Serializable cached, SessionImplementor session, Object owner) throws HibernateException { return cached; } final Object deepCopy(Object value); final boolean isMutable(); final Serializable disassemble(Object value); Serializable disassemble(Object ... | AbstractImmutableType extends AbstractType { public Object assemble( Serializable cached, SessionImplementor session, Object owner) throws HibernateException { return cached; } final Object deepCopy(Object value); final boolean isMutable(); final Serializable disassemble(Object value); Serializable disassemble(Object ... |
@Test public void deepCopy() { assertEquals(serializable, type.deepCopy(serializable)); } | public final Object deepCopy(Object value) { return value; } | AbstractImmutableType extends AbstractType { public final Object deepCopy(Object value) { return value; } } | AbstractImmutableType extends AbstractType { public final Object deepCopy(Object value) { return value; } } | AbstractImmutableType extends AbstractType { public final Object deepCopy(Object value) { return value; } final Object deepCopy(Object value); final boolean isMutable(); final Serializable disassemble(Object value); Serializable disassemble(Object value, SessionImplementor session); Object assemble(
Serializable... | AbstractImmutableType extends AbstractType { public final Object deepCopy(Object value) { return value; } final Object deepCopy(Object value); final boolean isMutable(); final Serializable disassemble(Object value); Serializable disassemble(Object value, SessionImplementor session); Object assemble(
Serializable... |
@Test public void disassemble() { assertEquals(serializable, type.disassemble(serializable)); assertEquals(serializable, type.disassemble(serializable, null)); } | public final Serializable disassemble(Object value) throws HibernateException { return (Serializable) value; } | AbstractImmutableType extends AbstractType { public final Serializable disassemble(Object value) throws HibernateException { return (Serializable) value; } } | AbstractImmutableType extends AbstractType { public final Serializable disassemble(Object value) throws HibernateException { return (Serializable) value; } } | AbstractImmutableType extends AbstractType { public final Serializable disassemble(Object value) throws HibernateException { return (Serializable) value; } final Object deepCopy(Object value); final boolean isMutable(); final Serializable disassemble(Object value); Serializable disassemble(Object value, SessionImpleme... | AbstractImmutableType extends AbstractType { public final Serializable disassemble(Object value) throws HibernateException { return (Serializable) value; } final Object deepCopy(Object value); final boolean isMutable(); final Serializable disassemble(Object value); Serializable disassemble(Object value, SessionImpleme... |
@Test public void constructMe3ByName() { Instantiator<ConstructMe3> instantiator = Instantiators .createInstantiator(ConstructMe3.class); ConstructMe3 instance = instantiator .newInstance(ImmutableMap.of( "name", "Jack Bauer", "pair", "First:Last")); assertNotNull(instance); assertEquals("Jack Bauer", instance.name.con... | public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } } | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... | Instantiators { public static <T> Instantiator<T> createInstantiator( Class<T> klass, InstantiatorModule... modules) { Errors errors = new Errors(); for (Instantiator<T> instantiator : createInstantiator(errors, klass, modules)) { return instantiator; } errors.throwIfHasErrors(); throw new IllegalStateException(); } pr... |
@Test public void isMutable() { assertFalse(type.isMutable()); } | public final boolean isMutable() { return false; } | AbstractImmutableType extends AbstractType { public final boolean isMutable() { return false; } } | AbstractImmutableType extends AbstractType { public final boolean isMutable() { return false; } } | AbstractImmutableType extends AbstractType { public final boolean isMutable() { return false; } final Object deepCopy(Object value); final boolean isMutable(); final Serializable disassemble(Object value); Serializable disassemble(Object value, SessionImplementor session); Object assemble(
Serializable cached, S... | AbstractImmutableType extends AbstractType { public final boolean isMutable() { return false; } final Object deepCopy(Object value); final boolean isMutable(); final Serializable disassemble(Object value); Serializable disassemble(Object value, SessionImplementor session); Object assemble(
Serializable cached, S... |
@Test public void equality() { assertTrue(type.equals(null, null)); assertFalse(type.equals(serializable, null)); assertFalse(type.equals(null, serializable)); assertTrue(type.equals(serializable, serializable)); } | public final boolean equals(Object x, Object y) throws HibernateException { if (x == y) { return true; } else if (x == null || y == null) { return false; } else { return x.equals(y); } } | AbstractType { public final boolean equals(Object x, Object y) throws HibernateException { if (x == y) { return true; } else if (x == null || y == null) { return false; } else { return x.equals(y); } } } | AbstractType { public final boolean equals(Object x, Object y) throws HibernateException { if (x == y) { return true; } else if (x == null || y == null) { return false; } else { return x.equals(y); } } } | AbstractType { public final boolean equals(Object x, Object y) throws HibernateException { if (x == y) { return true; } else if (x == null || y == null) { return false; } else { return x.equals(y); } } final boolean equals(Object x, Object y); final int hashCode(Object value); } | AbstractType { public final boolean equals(Object x, Object y) throws HibernateException { if (x == y) { return true; } else if (x == null || y == null) { return false; } else { return x.equals(y); } } final boolean equals(Object x, Object y); final int hashCode(Object value); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.