001package org.slf4j;
002
003import static junit.framework.Assert.assertTrue;
004
005public class OutputVerifier {
006
007    static void noProvider(StringPrintStream sps) {
008        dump(sps);
009        int lineCount = sps.stringList.size();
010        assertTrue("number of lines should be 6 but was " + lineCount, lineCount == 6);
011
012        // expected output: (version 1.8)
013        // SLF4J: No SLF4J providers were found.
014        // SLF4J: Defaulting to no-operation (NOP) logger implementation
015        // SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
016        // SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8.
017        // SLF4J: Ignoring binding found at
018        // [jar:file:..../slf4j-simple-1.4.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
019        // SLF4J: See http://www.slf4j.org/codes.html#ignoredBindings for an explanation.
020
021        {
022            String s = (String) sps.stringList.get(0);
023            assertTrue(s.contains("No SLF4J providers were found."));
024        }
025        {
026            String s = (String) sps.stringList.get(1);
027            assertTrue(s.contains("Defaulting to no-operation (NOP) logger implementation"));
028        }
029        {
030            String s = (String) sps.stringList.get(2);
031            assertTrue(s.contains("SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details."));
032        }
033
034        {
035            String s = (String) sps.stringList.get(3);
036            assertTrue(s.contains("SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8."));
037        }
038
039        {
040            String s = (String) sps.stringList.get(4);
041            assertTrue(s.contains("Ignoring binding found at"));
042        }
043        {
044            String s = (String) sps.stringList.get(5);
045            assertTrue(s.contains("See http://www.slf4j.org/codes.html#ignoredBindings for an explanation"));
046        }
047    }
048
049    public static void dump(StringPrintStream sps) {
050        for (String s : sps.stringList) {
051            System.out.println(s);
052        }
053    }
054}