CompositeHL7v2Exception extends AbstractHL7v2Exception implements
		Iterable<AbstractHL7v2Exception> { @Override public Message populateMessage(Message m, AckTypeCode code) { try { if (MessageUtils.atLeastVersion(m, "2.5")) { Segment errorSegment = (Segment) m.get("ERR"); fillErr347(errorSegment); } else { Segment msaSegment = (Segment) m.get("MSA"); Terser.set(msaSegment, 3, 0, 1, 1, getMessage()); } for (AbstractHL7v2Exception exception : wrapped) { exception.populateMessage(m, code); } return m; } catch (HL7Exception e) { throw new RuntimeException(e); } } CompositeHL7v2Exception();  CompositeHL7v2Exception(List<AbstractHL7v2Exception> wrapped);  CompositeHL7v2Exception(AbstractHL7v2Exception[] wrapped);  CompositeHL7v2Exception(String message,
			AbstractHL7v2Exception[] wrapped);  CompositeHL7v2Exception(String message);  CompositeHL7v2Exception(String message,
			List<AbstractHL7v2Exception> wrapped); boolean add(AbstractHL7v2Exception exception); @Override Message populateMessage(Message m, AckTypeCode code); @Override Iterator<AbstractHL7v2Exception> iterator();  }
@Test public void testMultipleSegments_Version23() throws Exception { ca.uhn.hl7v2.model.v23.message.ACK response = new ca.uhn.hl7v2.model.v23.message.ACK(); Terser t = new Terser(response); t.set("MSH-1", "|"); t.set("MSH-2", "^~\\&"); t.set("MSH-3", "X"); t.set("MSH-4", "Y"); t.set("MSH-9-1", "ACK"); t.set("MSH-9-2", "A08"); t.set("MSH-10", "1"); t.set("MSH-12", "2.3"); CompositeHL7v2Exception ex0 = new CompositeHL7v2Exception("Bluh", new HL7v2Exception[] { ex1, ex2, ex3 }); ex0.populateMessage(response, AckTypeCode.AE); String result = p.encode(response); assertTrue(result .contains("ERR|MSH^1^2^200&Unsupported message type&HL70357&&Blah~PID^5^4^201&Unsupported event code&HL70357&&Bleh~PV1^0^0^203&Unsupported version id&HL70357&&Blih")); }
@Test public void testMultipleSegments_Version25() throws Exception { ca.uhn.hl7v2.model.v25.message.ACK response = new ca.uhn.hl7v2.model.v25.message.ACK(); Terser t = new Terser(response); t.set("MSH-1", "|"); t.set("MSH-2", "^~\\&"); t.set("MSH-3", "X"); t.set("MSH-4", "Y"); t.set("MSH-9-1", "ACK"); t.set("MSH-9-2", "A08"); t.set("MSH-10", "1"); t.set("MSH-12", "2.5"); CompositeHL7v2Exception ex0 = new CompositeHL7v2Exception("Bluh", new HL7v2Exception[] { ex1, ex2, ex3 }); ex0.populateMessage(response, AckTypeCode.AE); String result = p.encode(response); assertTrue(result .contains("ERR||MSH^1^2^3^4^5~PID^5^4^3^2^1~PV1^0^0^0^0^0|203^Unsupported version id^HL70357^^Blih|E|||Blih")); }