@Test public void testGetDate() { }
public Date getDate() { String regex = "\\d+-\\d+-\\d+\\s*\\d+:\\d+:\\d+,\\d+"; Pattern timestamp = Pattern.compile(regex); Matcher timestampMatcher = timestamp.matcher(getMessage()); SimpleDateFormat f = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss,S"); if(timestampMatcher.find()) { try { return f.parse(timestampMatcher.group()); } catch (ParseException e) { throw (new IllegalArgumentException(e)); } }else{ throw (new IllegalArgumentException("Does not match")); } }
SimpleLogMessage implements LogMessage { public Date getDate() { String regex = "\\d+-\\d+-\\d+\\s*\\d+:\\d+:\\d+,\\d+"; Pattern timestamp = Pattern.compile(regex); Matcher timestampMatcher = timestamp.matcher(getMessage()); SimpleDateFormat f = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss,S"); if(timestampMatcher.find()) { try { return f.parse(timestampMatcher.group()); } catch (ParseException e) { throw (new IllegalArgumentException(e)); } }else{ throw (new IllegalArgumentException("Does not match")); } } }
SimpleLogMessage implements LogMessage { public Date getDate() { String regex = "\\d+-\\d+-\\d+\\s*\\d+:\\d+:\\d+,\\d+"; Pattern timestamp = Pattern.compile(regex); Matcher timestampMatcher = timestamp.matcher(getMessage()); SimpleDateFormat f = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss,S"); if(timestampMatcher.find()) { try { return f.parse(timestampMatcher.group()); } catch (ParseException e) { throw (new IllegalArgumentException(e)); } }else{ throw (new IllegalArgumentException("Does not match")); } } private  SimpleLogMessage(String logMessage); }
SimpleLogMessage implements LogMessage { public Date getDate() { String regex = "\\d+-\\d+-\\d+\\s*\\d+:\\d+:\\d+,\\d+"; Pattern timestamp = Pattern.compile(regex); Matcher timestampMatcher = timestamp.matcher(getMessage()); SimpleDateFormat f = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss,S"); if(timestampMatcher.find()) { try { return f.parse(timestampMatcher.group()); } catch (ParseException e) { throw (new IllegalArgumentException(e)); } }else{ throw (new IllegalArgumentException("Does not match")); } } private  SimpleLogMessage(String logMessage); static LogMessage create(String logMessage); String getMessage(); boolean isEndMessage(); @Override String toString(); boolean isPersistMessage(); boolean isPersistBeginMessage(); boolean isPersistEndMessage(); boolean isBeginMessage(); boolean isErrorMessage(); boolean isCollectorBeginMessage(); boolean isCollectorEndMessage(); Date getDate(); String getServiceID(); String getThread(); }
SimpleLogMessage implements LogMessage { public Date getDate() { String regex = "\\d+-\\d+-\\d+\\s*\\d+:\\d+:\\d+,\\d+"; Pattern timestamp = Pattern.compile(regex); Matcher timestampMatcher = timestamp.matcher(getMessage()); SimpleDateFormat f = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss,S"); if(timestampMatcher.find()) { try { return f.parse(timestampMatcher.group()); } catch (ParseException e) { throw (new IllegalArgumentException(e)); } }else{ throw (new IllegalArgumentException("Does not match")); } } private  SimpleLogMessage(String logMessage); static LogMessage create(String logMessage); String getMessage(); boolean isEndMessage(); @Override String toString(); boolean isPersistMessage(); boolean isPersistBeginMessage(); boolean isPersistEndMessage(); boolean isBeginMessage(); boolean isErrorMessage(); boolean isCollectorBeginMessage(); boolean isCollectorEndMessage(); Date getDate(); String getServiceID(); String getThread();  }