DataDictionary { public String getFieldName(int field) { return fieldNames.get(field); } private  DataDictionary();  DataDictionary(String location);  DataDictionary(String location, Supplier<DocumentBuilderFactory> documentBuilderFactorySupplier);  DataDictionary(InputStream in);  DataDictionary(InputStream in, Supplier<DocumentBuilderFactory> documentBuilderFactorySupplier);  DataDictionary(DataDictionary source); String getVersion(); String getFieldName(int field); String getValueName(int field, String value); String getValue(int field, String name); boolean isField(int field); FieldType getFieldType(int field); String getMsgType(String msgName); boolean isMsgType(String msgType); boolean isAdminMessage(String msgType); boolean isAppMessage(String msgType); boolean isMsgField(String msgType, int field); boolean isHeaderField(int field); boolean isTrailerField(int field); int getFieldTag(String name); boolean isRequiredField(String msgType, int field); boolean isRequiredHeaderField(int field); boolean isRequiredTrailerField(int field); boolean hasFieldValue(int field); boolean isFieldValue(int field, String value); boolean isGroup(String msg, int field); boolean isHeaderGroup(int field); GroupInfo getGroup(String msg, int field); boolean isDataField(int field); void setCheckFieldsOutOfOrder(boolean flag); boolean isCheckFieldsOutOfOrder(); boolean isCheckUnorderedGroupFields(); boolean isCheckFieldsHaveValues(); boolean isCheckUserDefinedFields(); boolean isAllowUnknownMessageFields(); void setCheckUnorderedGroupFields(boolean flag); void setCheckFieldsHaveValues(boolean flag); void setCheckUserDefinedFields(boolean flag); void setAllowUnknownMessageFields(boolean allowUnknownFields); void validate(Message message); void validate(Message message, boolean bodyOnly); int getNumMessageCategories(); int[] getOrderedFields(); static final String ANY_VALUE; static final String HEADER_ID; static final String TRAILER_ID; }
@Test public void testDictionaryWithFilename() throws Exception { DataDictionary dd = new DataDictionary("FIX40.xml"); assertEquals("wrong field name", "Currency", dd.getFieldName(15)); }
@Test public void testDictionaryInClassPath() throws Exception { URLClassLoader customClassLoader = new URLClassLoader(new URL[] { new URL("file:etc") }, getClass().getClassLoader()); Thread currentThread = Thread.currentThread(); ClassLoader previousContextClassLoader = currentThread.getContextClassLoader(); currentThread.setContextClassLoader(customClassLoader); try { DataDictionary dd = new DataDictionary("FIX40.xml"); assertEquals("wrong field name", "Currency", dd.getFieldName(15)); } finally { currentThread.setContextClassLoader(previousContextClassLoader); } }