Created
July 22, 2013 07:22
-
-
Save tzachz/6051904 to your computer and use it in GitHub Desktop.
logback verifier usage
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
import ch.qos.logback.classic.Level; | |
import com.kenshoo.test.LogbackVerifier; | |
import org.junit.Rule; | |
import org.junit.Test; | |
public class MyTest { | |
@Rule | |
public LogbackVerifier logbackVerifier = new LogbackVerifier(); | |
private MyTestedService service = new MyTestedService(); | |
@Test | |
public void verifyGoodScenario() throws Exception { | |
logbackVerifier.expectMessage(Level.INFO, "it worked"); | |
service.doSomething("good input"); | |
} | |
@Test | |
public void verifyBadScenario() throws Exception { | |
logbackVerifier.expectMessage(Level.ERROR, "something went wrong", IllegalArgumentException.class); | |
service.doSomething("bad input"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment