### Question:
QFJDictionaryAdapter extends DataDictionary { @Override public void validate(Message message, boolean bodyOnly) throws IncorrectTagValue, FieldNotFound, IncorrectDataFormat { validate(message, bodyOnly ? null : this, this); } QFJDictionaryAdapter(IDictionaryStructure iMsgDict); @Override String getVersion(); @Override boolean isMsgType(String msgType); @Override GroupInfo getGroup(String msg, int field); @Override void checkHasRequired(FieldMap header, FieldMap body, FieldMap trailer, String msgType,
			boolean bodyOnly); @Override void iterate(FieldMap map, String msgType, DataDictionary dd); @Override boolean isFieldValue(int field, String value); @Override void checkGroupCount(StringField field, FieldMap fieldMap, String msgType); @Override boolean isAdminMessage(String msgType); @Override void addMsgField(String msgType, int field); @Override void addGroup(String msg, int field, int delim, DataDictionary dataDictionary); @Override boolean hasVersion(); @Override String getBeginString(); @Override boolean isCheckFieldsOutOfOrder(); @Override boolean isCheckUnorderedGroupFields(); @Override boolean isCheckFieldsHaveValues(); @Override boolean isCheckUserDefinedFields(); @Override Map<String, Set<Integer>> getMessageFields(); @Override Map<String, Set<Integer>> getRequiredFields(); @Override Set<String> getMessages(); @Override Set<Integer> getFields(); @Override Map<Integer, Set<String>> getFieldValues(); @Override void setCheckFieldsOutOfOrder(boolean checkFieldsOutOfOrder); @Override void setCheckFieldsHaveValues(boolean checkFieldsHaveValues); @Override void setCheckUserDefinedFields(boolean checkUserDefinedFields); @Override void setAllowUnknownMessageFields(boolean allowUnknownMessageFields); @Override String getValueName(int tag, String value); @Override String getFieldName(int tag); @Override boolean isGroup(String msgId, int field); @Override int[] getOrderedFields(); @Override boolean isField(int tag); @Override boolean isHeaderField(int field); @Override boolean isTrailerField(int field); @Override boolean isDataField(int tag); @Override int getFieldTag(String name); @Override int getFieldType(int tag); @Override boolean hasFieldValue(int iTagNum); @Override FieldType getFieldTypeEnum(int tag); @Override boolean isHeaderGroup(int tag); @Override boolean isMsgField(String msgType, int tag); @Override void validate(Message message, boolean bodyOnly); @Override void setCheckUnorderedGroupFields(boolean checkUnorderedGroupFields); @Override void checkValidTagNumber(Field<?> field); @Override String getMessageName(String msgType); @Override Map<IntStringPair, GroupInfo> getGroups(); void setCheckRequiredFields(boolean checkRequiredFields); boolean isCheckRequiredFields(); static final String ATTRIBUTE_FIX_TYPE; }### Answer:
@Test public void testValidationThrowsCorrectExceptionIfTagNotDefinedInDictionary() throws Exception { try { String messageString = "8=FIXT.1.19=9435=RG34=321749=TEST_152=20200428-16:47:06.204" + "56=FMSSTEST1777=1448=mb447=D452=311=12322222=12310=152"; Message message = MessageUtils.parse(session, messageString); qfjDictionaryAdapter.validate(message, false); Assert.fail("Failed negative test to validate required tags, no expected error"); } catch (FieldException e){ Assert.assertEquals(22222, e.getField()); Assert.assertEquals(SessionRejectReason.TAG_NOT_DEFINED_FOR_THIS_MESSAGE_TYPE, e.getSessionRejectReason()); } }