Created
September 12, 2011 17:04
-
-
Save coderunner/1211780 to your computer and use it in GitHub Desktop.
Revisions
-
coderunner revised this gist
Sep 13, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public class TestStreamLogger public void setup() { stream = mock(OutputStream.class); logger = new StreamLogger(LOGGER_NAME, stream); } @Test -
coderunner created this gist
Sep 12, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ public class TestStreamLogger { private static final String LOGGER_NAME = "logger_name"; private static final Level LEVEL = Level.INFO; private static final String MESSAGE = "message"; private StreamLogger logger; private OutputStream stream; @Before public void setup() { stream = mock(OutputStream.class); logger = new StreamLogger("logger_name", stream); } @Test public void shouldWriteFormattedMesssageToStream() throws Exception { logger.log(Level.INFO, MESSAGE); verify(stream).write((LOGGER_NAME +" - " + LEVEL + " : " + MESSAGE).getBytes()); } @Test public void shouldCloseStream() throws Exception { logger.close(); verify(stream).close(); } }