github.phpd.cn/thought-machine/please@v12.2.0+incompatible/tools/junit_runner/src/build/please/test/ResourcesRootTest.java (about)

     1  package build.please.test;
     2  
     3  import org.junit.Ignore;
     4  import org.junit.Test;
     5  
     6  import ch.qos.logback.classic.Level;
     7  import ch.qos.logback.classic.Logger;
     8  import ch.qos.logback.classic.LoggerContext;
     9  import org.slf4j.LoggerFactory;
    10  
    11  import static org.junit.Assert.assertEquals;
    12  
    13  
    14  public class ResourcesRootTest {
    15    // Test for setting resources_root on a java_library rule. Logback is the motivating case here.
    16  
    17    @Test
    18    public void testAutoConfigurationLevel() throws Exception {
    19      // If logback-test.xml is on the classpath the level will get set to INFO. By default it's DEBUG.
    20      LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
    21      Logger logger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
    22      assertEquals(Level.INFO, logger.getLevel());
    23    }
    24  }