### Question:
ServiceCollector { public void addMessage(LogMessage msg) { if (!m_serviceID.equals(msg.getServiceID())) { throw new IllegalArgumentException("ServiceID of log message does not match serviceID of ServiceCollector: " + m_serviceID); } if (msg.isCollectorBeginMessage()) { m_lastBegin = msg.getDate().getTime(); if (m_lastEnd > 0) { m_totalBetweenTime += msg.getDate().getTime() - m_lastEnd; m_betweenCount++; } m_lastEnd = 0; } if (msg.isErrorMessage()) { m_lastErrorBegin = m_lastBegin; } if (msg.isCollectorEndMessage()) { long end = msg.getDate().getTime(); m_lastEnd = msg.getDate().getTime(); if (m_lastBegin > 0) { m_totalTime += end - m_lastBegin; m_collectionCount++; } m_lastBegin = 0; if (m_lastErrorBegin > 0) { m_errorTime += end - m_lastErrorBegin; m_errorCount++; } m_lastErrorBegin = 0; } if (msg.isPersistBeginMessage()) { m_lastPersistBegin = msg.getDate().getTime(); } if (msg.isPersistEndMessage()) { long end = msg.getDate().getTime(); msg.getDate().getTime(); if(m_lastPersistBegin > 0) { m_totalPersistTime += end - m_lastPersistBegin; m_persistCount++; } m_lastPersistBegin = 0; } } ServiceCollector(String serviceID); String getServiceID(); void addMessage(LogMessage msg); String getParsedServiceID(); int getCollectionCount(); int getErrorCollectionCount(); int getPersistCount(); long getTotalCollectionTime(); Duration getTotalCollectionDuration(); long getErrorCollectionTime(); Duration getErrorCollectionDuration(); long getSuccessfulCollectionTime(); Duration getSuccessfulCollectionDuration(); long getTotalPersistTime(); Duration getTotalPersistDuration(); int getSuccessfulCollectionCount(); double getSuccessPercentage(); double getErrorPercentage(); long getAverageCollectionTime(); Duration getAverageCollectionDuration(); long getAveragePersistTime(); Duration getAveragePersistDuration(); long getAverageErrorCollectionTime(); Duration getAverageErrorCollectionDuration(); long getAverageSuccessfulCollectionTime(); Duration getAverageSuccessfulCollectionDuration(); long getAverageTimeBetweenCollections(); Duration getAverageDurationBetweenCollections(); @Override boolean equals(Object obj); @Override int hashCode(); final String m_regex; final Pattern m_pattern; }### Answer:
@Test(expected=IllegalArgumentException.class) public void testServiceIDCheck() { String serviceID = "1/1.1.1.1/SVC"; ServiceCollector svcCollector = new ServiceCollector(serviceID); LogMessage startMessage = BaseLogMessage.create("2010-05-26 12:12:18,027 DEBUG [CollectdScheduler-50 Pool-fiber11] Collectd: collector.collect:" + " begin:24/216.216.217.254/SNMP"); svcCollector.addMessage(startMessage); }