Codota Logo
TestLogger.contains
Code IndexAdd Codota to your IDE (free)

How to use
contains
method
in
slf4jtest.TestLogger

Best Java code snippets using slf4jtest.TestLogger.contains (Showing top 7 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: portingle/slf4jtesting

/**
 * check if a regex exists in a particular log level output.
 */
public boolean contains(LogLevel level, String substring) {
  for (TestLogger l : loggers.values()) {
    if (l.contains(level, substring))
      return true;
  }
  return false;
}
origin: com.portingle/slf4jtesting

/**
 * check if a regex exists in a particular log level output.
 */
public boolean contains(LogLevel level, String substring) {
  for (TestLogger l : loggers.values()) {
    if (l.contains(level, substring))
      return true;
  }
  return false;
}
origin: portingle/slf4jtesting

public void testPrintSuppressionsAffectsPrintStreamAndNotLogging() {
  StringPrintStream ps = StringPrintStream.newStream();
  TestLoggerFactory f = Settings.instance()
      .redirectPrintStream(LogLevel.ErrorLevel, ps)
      .suppressPrinting(".*suppressPrinting-me.*")
      .buildLogging();
  TestLogger log = f.getLogger("john");
  String ShouldBeLogged = "printme";
  String ShouldBePrintSuppressed = "suppressPrinting-me <<" + System.lineSeparator() + " dont print";
  log.error(ShouldBeLogged);
  log.error(ShouldBePrintSuppressed);
  assert (ps.toString().contains(ShouldBeLogged));
  assert (log.contains(ShouldBeLogged));
  assert (!ps.toString().contains(ShouldBePrintSuppressed));
  assert (log.contains(ShouldBePrintSuppressed));
}
origin: portingle/slf4jtesting

public void testConsolePrintingCanBeDisabledButLinesAreStillRecorded() {
  StringPrintStream console = StringPrintStream.newStream();
  PrintStream old = System.err;
  System.setErr(console); // << have to interfere with the system for this test
  try {
    TestLoggerFactory f  = Settings.instance().printingEnabled(false).buildLogging();
    TestLogger log = f.getLogger("john");
    log.error("anError");
    assert (!console.contains("anError"));
    assert (log.contains("anError"));
  } finally {
    System.setErr(old);
  }
}
origin: portingle/slf4jtesting

public void testLoggingDefaults() {
  StringPrintStream console = StringPrintStream.newStream();
  PrintStream old = System.err;
  System.setErr(console);
  try {
    TestLoggerFactory f = new TestLoggerFactory();
    TestLogger log = f.getLogger("john");
    log.error("anError");
    log.info("someInfo");
    assert (console.contains("anError"));
    assert (!console.contains("someInfo"));
    assert (log.contains("anError"));
    assert (!log.contains("someInfo"));
    assert (console.matches(".*anError.*"));
    assert (!console.matches(".*someInfo.*"));
    assert (log.matches(".*anError.*"));
    assert (!log.matches(".*someInfo.*"));
  } finally {
    System.setErr(old);
  }
}
origin: portingle/slf4jtesting

public void testPrintStreamCanBeOverridden() {
  StringPrintStream ps = StringPrintStream.newStream();
  TestLoggerFactory f = Settings.instance()
      .redirectPrintStream(LogLevel.ErrorLevel, ps).buildLogging();
  TestLogger log = f.getLogger("john");
  log.error("anError");
  assert (ps.contains("anError"));
  assert (log.contains("anError"));
}
origin: portingle/slf4jtesting

public void testAssociatedPrintingCanBeDisabledButLinesAreStillRecorded() {
  StringPrintStream ps = StringPrintStream.newStream();
  TestLoggerFactory loggerFactory = Settings.instance().
      printingEnabled(false).redirectPrintStream(LogLevel.ErrorLevel, ps).
      buildLogging();
  TestLogger log = loggerFactory.getLogger("john");
  log.error("anError");
  assert (!ps.contains("anError"));
  assert (log.contains("anError"));
}
slf4jtestTestLoggercontains

Popular methods of TestLogger

  • lines
  • matches
  • clear
  • assertMatches
  • error
  • info
  • isErrorEnabled
  • isWarnEnabled

Popular in Java

  • Parsing JSON documents to java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • findViewById (Activity)
  • setContentView (Activity)
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now