Message extends FieldMap { private void setField(FieldMap fields, StringField field) { if (fields.isSetField(field)) { throw new FieldException(SessionRejectReason.TAG_APPEARS_MORE_THAN_ONCE, field.getTag()); } fields.setField(field); } Message(); protected  Message(int[] fieldOrder);  Message(String string);  Message(String string, boolean validate);  Message(String string, DataDictionary dd);  Message(String string, DataDictionary dd, boolean validate);  Message(String string, DataDictionary sessionDictionary, DataDictionary applicationDictionary, boolean validate); static boolean InitializeXML(String url); @Override Object clone(); @Override String toString(); String toRawString(); int bodyLength(); void headerAddGroup(Group group); void headerReplaceGroup(int num, Group group); Group headerGetGroup(int num, Group group); void headerRemoveGroup(Group group); boolean headerHasGroup(int field); boolean headerHasGroup(int num, int field); boolean headerHasGroup(int num, Group group); boolean headerHasGroup(Group group); void trailerAddGroup(Group group); Group trailerGetGroup(int num, Group group); void trailerReplaceGroup(int num, Group group); void trailerRemoveGroup(Group group); boolean trailerHasGroup(int field); boolean trailerHasGroup(int num, int field); boolean trailerHasGroup(int num, Group group); boolean trailerHasGroup(Group group); String toXML(); String toXML(DataDictionary dataDictionary); final Header getHeader(); final Trailer getTrailer(); boolean isAdmin(); boolean isApp(); @Override boolean isEmpty(); @Override void clear(); @Override void reset(); void reverseRoute(Header header); void fromString(String messageData, DataDictionary dd, boolean doValidation); void fromString(String messageData, DataDictionary dd, boolean doValidation,
            boolean validateChecksum); void fromString(String messageData, DataDictionary sessionDictionary,
            DataDictionary applicationDictionary, boolean doValidation); void fromString(String messageData, DataDictionary sessionDictionary,
            DataDictionary applicationDictionary, boolean doValidation, boolean validateChecksum); void pushBack(StringField field); FieldException getException(); static MsgType identifyType(String message);  }
@Test public void testRemoveField() { final Message message = new Message(); message.setField(new StringField(12, "value")); assertTrue(message.isSetField(12)); message.removeField(12); assertTrue(!message.isSetField(12)); }
@Test public void testReplaceGroup() throws Exception { final Message message = new Message(); message.setField(new ListID("1")); message.setField(new BidType(0)); message.setField(new TotNoOrders(3)); final NewOrderList.NoOrders group = new NewOrderList.NoOrders(); group.set(new ClOrdID("A")); group.set(new ListSeqNo(1)); group.set(new Symbol("DELL")); group.set(new Side('1')); message.addGroup(group); group.set(new ClOrdID("B")); group.set(new ListSeqNo(2)); group.set(new Symbol("LNUX")); group.set(new Side('2')); message.addGroup(group); group.set(new ClOrdID("C")); group.set(new ListSeqNo(3)); group.set(new Symbol("RHAT")); group.set(new Side('3')); message.addGroup(group); group.set(new ClOrdID("D")); group.set(new ListSeqNo(4)); group.set(new Symbol("AAPL")); group.set(new Side('4')); message.replaceGroup(2, group); final NoOrders noOrders = new NoOrders(); assertTrue(message.hasGroup(1, group)); assertTrue(message.hasGroup(2, group)); assertTrue(message.hasGroup(3, group)); assertEquals(3, message.getGroupCount(NoOrders.FIELD)); message.getField(noOrders); assertEquals(3, noOrders.getValue()); final ClOrdID clOrdID = new ClOrdID(); message.getGroup(1, group); assertEquals("A", group.getField(clOrdID).getValue()); message.getGroup(2, group); assertEquals("D", group.getField(clOrdID).getValue()); message.getGroup(3, group); assertEquals("C", group.getField(clOrdID).getValue()); }