@Test public void testProcessAnnotationWithParametersMissingComma() { AnnotationProcessor processor=new AnnotationProcessor(); String name="Interface"; String p1value="{http: String p2value="MyOtherValue"; Interaction mobj=new Interaction(); String annotationText=name+"(p1="+p1value+" p2="+p2value+")"; CachedJournal journal=new CachedJournal(); processor.getAnnotation(annotationText, mobj.getProperties(), journal); if (journal.hasErrors() == false) { fail("Error expected"); } }
public Annotation getAnnotation(String annotation, java.util.Map<String, Object> properties, Journal journal) { java.util.StringTokenizer st=new java.util.StringTokenizer(annotation); String name=st.nextToken(" ("); Annotation an=new Annotation(name); if (st.hasMoreTokens()) { String token=st.nextToken("()"); if (token != null) { String[] props=token.split(","); for (int i=0; i < props.length; i++) { String[] vals=props[i].split("="); if (vals.length != 2) { journal.error("Name/Value of annotation could not be derived", properties); } else { an.getProperties().put(vals[0], vals[1]); } } int index=annotation.indexOf(token); if (index != -1) { index = annotation.indexOf(')', index+token.length()); if (index == -1) { journal.error("')' not found in annotation", properties); } } } else { journal.error("'(' not found in annotation", properties); } } return(an); }
AnnotationProcessor implements org.scribble.protocol.parser.AnnotationProcessor { public Annotation getAnnotation(String annotation, java.util.Map<String, Object> properties, Journal journal) { java.util.StringTokenizer st=new java.util.StringTokenizer(annotation); String name=st.nextToken(" ("); Annotation an=new Annotation(name); if (st.hasMoreTokens()) { String token=st.nextToken("()"); if (token != null) { String[] props=token.split(","); for (int i=0; i < props.length; i++) { String[] vals=props[i].split("="); if (vals.length != 2) { journal.error("Name/Value of annotation could not be derived", properties); } else { an.getProperties().put(vals[0], vals[1]); } } int index=annotation.indexOf(token); if (index != -1) { index = annotation.indexOf(')', index+token.length()); if (index == -1) { journal.error("')' not found in annotation", properties); } } } else { journal.error("'(' not found in annotation", properties); } } return(an); } }
AnnotationProcessor implements org.scribble.protocol.parser.AnnotationProcessor { public Annotation getAnnotation(String annotation, java.util.Map<String, Object> properties, Journal journal) { java.util.StringTokenizer st=new java.util.StringTokenizer(annotation); String name=st.nextToken(" ("); Annotation an=new Annotation(name); if (st.hasMoreTokens()) { String token=st.nextToken("()"); if (token != null) { String[] props=token.split(","); for (int i=0; i < props.length; i++) { String[] vals=props[i].split("="); if (vals.length != 2) { journal.error("Name/Value of annotation could not be derived", properties); } else { an.getProperties().put(vals[0], vals[1]); } } int index=annotation.indexOf(token); if (index != -1) { index = annotation.indexOf(')', index+token.length()); if (index == -1) { journal.error("')' not found in annotation", properties); } } } else { journal.error("'(' not found in annotation", properties); } } return(an); }  }
AnnotationProcessor implements org.scribble.protocol.parser.AnnotationProcessor { public Annotation getAnnotation(String annotation, java.util.Map<String, Object> properties, Journal journal) { java.util.StringTokenizer st=new java.util.StringTokenizer(annotation); String name=st.nextToken(" ("); Annotation an=new Annotation(name); if (st.hasMoreTokens()) { String token=st.nextToken("()"); if (token != null) { String[] props=token.split(","); for (int i=0; i < props.length; i++) { String[] vals=props[i].split("="); if (vals.length != 2) { journal.error("Name/Value of annotation could not be derived", properties); } else { an.getProperties().put(vals[0], vals[1]); } } int index=annotation.indexOf(token); if (index != -1) { index = annotation.indexOf(')', index+token.length()); if (index == -1) { journal.error("')' not found in annotation", properties); } } } else { journal.error("'(' not found in annotation", properties); } } return(an); }  Annotation getAnnotation(String annotation, java.util.Map<String, Object> properties,
								Journal journal); }
AnnotationProcessor implements org.scribble.protocol.parser.AnnotationProcessor { public Annotation getAnnotation(String annotation, java.util.Map<String, Object> properties, Journal journal) { java.util.StringTokenizer st=new java.util.StringTokenizer(annotation); String name=st.nextToken(" ("); Annotation an=new Annotation(name); if (st.hasMoreTokens()) { String token=st.nextToken("()"); if (token != null) { String[] props=token.split(","); for (int i=0; i < props.length; i++) { String[] vals=props[i].split("="); if (vals.length != 2) { journal.error("Name/Value of annotation could not be derived", properties); } else { an.getProperties().put(vals[0], vals[1]); } } int index=annotation.indexOf(token); if (index != -1) { index = annotation.indexOf(')', index+token.length()); if (index == -1) { journal.error("')' not found in annotation", properties); } } } else { journal.error("'(' not found in annotation", properties); } } return(an); }  Annotation getAnnotation(String annotation, java.util.Map<String, Object> properties,
								Journal journal);  }