### Question:
ProtocolConfig implements Serializable { public Message getMessage(String name) { return messageMap.get(name); } ProtocolConfig(Protocol protocol);  ProtocolConfig(String path); String getProtocolName(); Message getMessage(String name); Message[] getMessages(); String getComponentPackage(); String getMsgType(String messageName); String getNameForTag(Integer t); Integer getTagForName(String name); boolean tagContains(Integer tag); String getMsgName(String msgType); boolean isAdmin(String msgName); boolean isHeaderField(String fieldName); boolean isHeaderField(Integer tag); @Override String toString(); List<Delegate> getClientDelegates(); StopEvent getStopEvent(); List<UrlExtension> getClientUrlExtensions(); Client getClient(); Protocol getProtocol(); void setProtocol(Protocol protocol); AbstractDictionary getDictionary(); void setDictionary(AbstractDictionary dictionary);  }### Answer:
@Test public void testBadProtocol() { String protocolPath = "${etiqet.directory}/etiqet-core/src/test/resources/protocols/testBadProtocol.xml"; try { ProtocolConfig protocolConfig = new ProtocolConfig(protocolPath); fail("Creation of ProtocolConfig with testBadProtocol.xml should throw an exception"); } catch (Exception e) { assertTrue(e instanceof EtiqetException); assertEquals("Unable to load messages configuration: " + protocolPath, e.getMessage()); assertEquals("Error loading dictionaryHandler: com.neueda.etiqet.core.TestDictionary", e.getCause().getMessage()); } }
@Test public void testInvalidProtocol() { String protocolPath = "${etiqet.directory}/etiqet-core/src/test/resources/protocols/testInvalidProtocol.xml"; try { ProtocolConfig protocolConfig = new ProtocolConfig(protocolPath); fail("Creation of ProtocolConfig with testInvalidProtocol.xml should throw an exception"); } catch (Exception e) { assertTrue(e instanceof EtiqetException); assertEquals("Unable to load messages configuration: " + protocolPath, e.getMessage()); } }
@Test public void testNoDictionaryProtocol() throws EtiqetException { String protocolPath = "${etiqet.directory}/etiqet-core/src/test/resources/protocols/testNoDictionaryProtocol.xml"; try { ProtocolConfig protocolConfig = new ProtocolConfig(protocolPath); } catch (Exception e) { assertTrue(e instanceof EtiqetException); assertEquals("Unable to load messages configuration: " + protocolPath, e.getMessage()); } }
@Test public void testNoDictionaryHandlerProtocol() throws EtiqetException { String protocolPath = "${etiqet.directory}/etiqet-core/src/test/" + "resources/protocols/testNoDictionaryHandlerProtocol.xml"; try { ProtocolConfig protocolConfig = new ProtocolConfig(protocolPath); } catch (Exception e) { assertTrue(e instanceof EtiqetException); assertEquals("Unable to load messages configuration: " + protocolPath, e.getMessage()); } }
@Test public void testDictionaryFieldsNoDictionary() throws EtiqetException { String protocolPath = "${etiqet.directory}/etiqet-core/src/test/resources/protocols/testNoDictionaryProtocol.xml"; try { ProtocolConfig protocolConfig = new ProtocolConfig(protocolPath); } catch (Exception e) { assertTrue(e instanceof EtiqetException); assertEquals("Unable to load messages configuration: " + protocolPath, e.getMessage()); } }