Skip to content

Instantly share code, notes, and snippets.

@coderunner
Created September 11, 2011 23:52
Show Gist options
  • Select an option

  • Save coderunner/1210314 to your computer and use it in GitHub Desktop.

Select an option

Save coderunner/1210314 to your computer and use it in GitHub Desktop.

Revisions

  1. coderunner created this gist Sep 11, 2011.
    22 changes: 22 additions & 0 deletions gistfile1.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    public class TestLogger
    {
    private static final String LOGGER_NAME = "logger_name";
    private static final Level LEVEL = Level.INFO;
    private static final String MESSAGE = "message";
    private static final String FORMATTED_LOG = LOGGER_NAME + " - " + LEVEL + " : " + MESSAGE;

    private Logger logger;

    @Before
    public void setup()
    {
    logger = spy(new Logger(LOGGER_NAME)
    {
    @Override
    protected void log(String formattedLog)
    {}
    });

    //mock abstract method
    doNothing().when(logger).log(anyString());
    }