Created
January 9, 2013 03:08
-
-
Save debop/4490246 to your computer and use it in GitHub Desktop.
UnitTest for Scala Logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package kr.kth.commons.slf4j | |
import org.junit.Test | |
/** | |
* User: [email protected] | |
* Date: 13. 1. 8 | |
*/ | |
class LoggingTest extends Logging { | |
@Test | |
def printString() { | |
log.trace("Trace Simple String") | |
log.debug("Debug Simple String") | |
log.info("Info Simple String") | |
log.warn("Warn Simple String") | |
log.error("Error Simple String") | |
} | |
@Test | |
def printAnyVal() { | |
log.debug("print 1") | |
log.debug(1) | |
} | |
case class Card(val name: String, val year: Int) | |
@Test | |
def printAnyRef() { | |
log.debug("print Card object (name=Credit, year=2006)") | |
log.debug(new Card("Credit", 2006)) | |
} | |
@Test | |
def printFormatString() { | |
log.trace("Format String. Card=[{}]", new Card("Format", 2013)) | |
log.debug("Format String. Card=[{}]", new Card("Format", 2013)) | |
log.info("Format String. Card=[{}]", new Card("Format", 2013)) | |
log.warn("Format String. Card=[{}]", new Card("Format", 2013)) | |
log.error("Format String. Card=[{}]", new Card("Format", 2013)) | |
} | |
@Test | |
def printException() { | |
log.debug("Print exception", new RuntimeException("for test")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment