View Javadoc
1   package org.slf4j;
2   
3   import static junit.framework.Assert.assertTrue;
4   
5   public class OutputVerifier {
6   
7       static void noProvider(StringPrintStream sps) {
8           dump(sps);
9           int lineCount = sps.stringList.size();
10          assertTrue("number of lines should be 6 but was " + lineCount, lineCount == 6);
11  
12          // expected output: (version 1.8)
13          // SLF4J: No SLF4J providers were found.
14          // SLF4J: Defaulting to no-operation (NOP) logger implementation
15          // SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
16          // SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8.
17          // SLF4J: Ignoring binding found at
18          // [jar:file:..../slf4j-simple-1.4.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
19          // SLF4J: See http://www.slf4j.org/codes.html#ignoredBindings for an explanation.
20  
21          {
22              String s = (String) sps.stringList.get(0);
23              assertTrue(s.contains("No SLF4J providers were found."));
24          }
25          {
26              String s = (String) sps.stringList.get(1);
27              assertTrue(s.contains("Defaulting to no-operation (NOP) logger implementation"));
28          }
29          {
30              String s = (String) sps.stringList.get(2);
31              assertTrue(s.contains("SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details."));
32          }
33  
34          {
35              String s = (String) sps.stringList.get(3);
36              assertTrue(s.contains("SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8."));
37          }
38  
39          {
40              String s = (String) sps.stringList.get(4);
41              assertTrue(s.contains("Ignoring binding found at"));
42          }
43          {
44              String s = (String) sps.stringList.get(5);
45              assertTrue(s.contains("See http://www.slf4j.org/codes.html#ignoredBindings for an explanation"));
46          }
47      }
48  
49      public static void dump(StringPrintStream sps) {
50          for (String s : sps.stringList) {
51              System.out.println(s);
52          }
53      }
54  }