### Question:
MessageStructureReader { public void traverse(IMessageStructureVisitor msgStrVisitor, IMessageStructure msgStructure, IMessage message, IMessageStructureReaderHandler handler) { try { traverse(msgStrVisitor, msgStructure.getFields(), message, handler); } catch ( Exception e ) { StringBuilder builder = new StringBuilder(); builder.append(e.getMessage()).append(". in MessageStructure Name = ["); if(msgStructure != null && msgStructure.getName() != null){ builder.append(msgStructure.getName()); } builder.append("]"); throw new EPSCommonException(builder.toString(), e); } } protected  MessageStructureReader(); void traverse(IMessageStructureVisitor msgStrVisitor,
                         IMessageStructure msgStructure,
                         IMessage message,
                         IMessageStructureReaderHandler handler); void traverse(IMessageStructureVisitor msgStrVisitor,
            Map<String, IFieldStructure> fields,
			IMessage message,
			IMessageStructureReaderHandler handler); static MessageStructureReader READER; }### Answer:
@Test public void testTraverse() throws IOException { IDictionaryStructure dictionary = loadDictionary(); IMessageStructure structure = dictionary.getMessages().get("TestMessage"); IMessage message = DefaultMessageFactory.getFactory().createMessage(structure.getName(), dictionary.getNamespace()); message.addField("Boolean", "true"); message.addField("Byte", 1); message.addField("Short", 2); message.addField("Integer", "3"); message.addField("Long", 4); message.addField("Float", 5.1); message.addField("Double", 6.2); message.addField("BigDecimal", "7"); message.addField("Character", 8); message.addField("String", 9); message.addField("LocalDate", "2016-08-18"); message.addField("LocalTime", "01:02:03.123456789"); message.addField("LocalDateTime", "2016-08-18T01:02:03.123456789"); message.addField("Collection", Arrays.asList("1", "2", "3", "4")); IMessageStructureVisitor visitor = new TestVisitor<>(); MessageStructureReader.READER.traverse(visitor, structure, message, MessageStructureReaderHandlerImpl.instance()); structure.getFields().forEach((fieldName, fldStructure) -> { String expectedType = fldStructure.getJavaType().value(); if (fldStructure.isCollection()) { message.<Iterable<?>>getField(fieldName).forEach(element -> Assert.assertEquals(expectedType, element.getClass().getName())); } else { Assert.assertEquals(expectedType, message.getField(fieldName).getClass().getName()); } }); }
@Test public void testDefaultValueIsNotPutToMessage() throws IOException { IDictionaryStructure dictionary = loadDictionary(); IMessageStructure messageStructure = dictionary.getMessages().get("MessageWithDefaultValues"); IMessage message = DefaultMessageFactory.getFactory().createMessage(messageStructure.getName(), dictionary.getNamespace()); IMessageStructureVisitor visitor = new TestVisitor<>(); MessageStructureReader.READER.traverse(visitor, messageStructure, message, MessageStructureReaderHandlerImpl.instance()); Assert.assertEquals("Message has unexpected fields", 0, message.getFieldCount()); }