Package eu.bges.log

Examples of eu.bges.log.ConsoleHandler


        final Exception exception = new Exception(exceptionMsg);
        final String logMsg = "something's gone wrong";
        final LogRecord record = LogTestUtil
                .createSevereRecordMsgWithException(logMsg, exception,
                        getClass(), thisMethodsName);
        new ConsoleHandler().publish(record);
        final String errMsg = errLog.getLog();
        final boolean containsExceptionMsg = errMsg.contains(exceptionMsg);
        assertTrue(
                "The exception message should be printed to the standard error stream",
                containsExceptionMsg);
View Full Code Here


        final Exception exception = new Exception(exceptionMsg);
        final String logMsg = "something's gone wrong";
        final LogRecord record = LogTestUtil
                .createSevereRecordMsgWithException(logMsg, exception,
                        getClass(), thisMethodsName);
        new ConsoleHandler().publish(record);
        final String errMsg = errLog.getLog();
        final boolean containsLogMsg = errMsg.contains(logMsg);
        assertTrue(
                "The lob message should be printed to the standard error stream",
                containsLogMsg);
View Full Code Here

    @Test
    public void logToStandardOutContainsLinkToLine() {
        final String thisMethodsName = "logToStandardOutContainsLinkToLine";
        final LogRecord record = LogTestUtil.createInfoRecord(
                LogTestUtil.SIMPLE_LOG_MSG, getClass(), thisMethodsName);
        new ConsoleHandler().publish(record);
        // Assumes that this class and the file it lives in have the same name
        final String fileName = getClass().getSimpleName();
        final String linkRegex = "\\(" + fileName + "\\.java:\\d+\\) ";
        final String logMsg = outLog.getLog();
        final Pattern p = Pattern.compile(linkRegex);
View Full Code Here

    @Test
    public void logToStandardOutContainsLocalTime() {
        final String thisMethodsName = "logToStandardOutContainsLocalTime";
        final LogRecord record = LogTestUtil.createInfoRecord(
                LogTestUtil.SIMPLE_LOG_MSG, getClass(), thisMethodsName);
        new ConsoleHandler().publish(record);
        final String dateAsStr = TimeUtil.toLocal(System.currentTimeMillis());
        final boolean containsLocalTime = outLog.getLog().contains(dateAsStr);
        assertTrue(
                "The local time of the log message should be printed to standard out",
                containsLocalTime);
View Full Code Here

    public void logToStandardOutContainsMsg() {
        final String thisMethodsName = "logToStandardOutContainsMsg";
        final String msg = LogTestUtil.SIMPLE_LOG_MSG;
        final LogRecord record = LogTestUtil.createInfoRecord(msg, getClass(),
                thisMethodsName);
        new ConsoleHandler().publish(record);
        final boolean containsMsg = outLog.getLog().contains(msg);
        assertTrue("The log message should be printed to standard out",
                containsMsg);
    }
View Full Code Here

                containsMsg);
    }

    @Test
    public void publishingNullGivesErrorMsg() {
        new ConsoleHandler().publish(null);
        assertFalse(errLog.getLog().isEmpty());
    }
View Full Code Here

TOP

Related Classes of eu.bges.log.ConsoleHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.