### Question:
EventFormatReader { public EventFormat getEventFormat() throws IOException { String fileName = m_resource.getFilename(); String eventCode = "deadbeef"; Matcher m = Pattern.compile("^Event([0-9A-Fa-f]+)$").matcher(fileName); if (m.matches()) { eventCode = "0x" + m.group(1); } EventFormat ef = new EventFormat(eventCode); StringBuilder contents = new StringBuilder(""); String thisLine; while ((thisLine = m_reader.readLine()) != null) { contents.append(thisLine).append("\n"); } ef.setContents(contents.toString()); return ef; } EventFormatReader(Resource rsrc); EventFormat getEventFormat();  }### Answer:
@Test public void readCovergenceSystemHaltEventFormat() throws IOException { EventFormatReader reader = new EventFormatReader(new FileSystemResource("src/test/resources/sonus-traps/CsEvFormat/Eventfff0034e")); EventFormat ef = reader.getEventFormat(); Assert.assertEquals("Check the contents against known good copy", "{d \"%w- %d %m-, %Y - %T\"} - A \"systemHalt\" event has occurred, from {t} device, named {m}.\n" + "\n" + "\"system: report that a system halt has been initiated\"\n" + "\n" + "(event [{e}])\n", ef.getContents()); Assert.assertEquals("Format should have four substitution tokens", 4, ef.getSubstTokens().size()); Assert.assertEquals("Date stamp substitution token", "{d \"%w- %d %m-, %Y - %T\"}", ef.getSubstTokens().get(0)); Assert.assertEquals("Model type substitution token", "{t}", ef.getSubstTokens().get(1)); Assert.assertEquals("Model name substitution token", "{m}", ef.getSubstTokens().get(2)); Assert.assertEquals("Event code substitution token", "{e}", ef.getSubstTokens().get(3)); }