aboutsummaryrefslogtreecommitdiffstats
path: root/jdisc_core_test/integration_test/src/test/java/com/yahoo/jdisc/core/OsgiLogManagerIntegrationTest.java
blob: 629bef6ded3579f2255db022ca8b8ad8f14bf442 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.core;

import org.junit.Test;
import org.mockito.Mockito;
import org.osgi.framework.BundleContext;

import java.util.logging.Level;
import java.util.logging.Logger;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;


/**
 * @author Simon Thoresen Hult
 */
public class OsgiLogManagerIntegrationTest {

    @Test
    public void requireThatRootLoggerLevelIsNotModifiedIfLoggerConfigIsGiven() {
        Logger logger = Logger.getLogger("");
        logger.setLevel(Level.WARNING);

        OsgiLogManager.newInstance().install(Mockito.mock(BundleContext.class));

        assertNotNull(System.getProperty("java.util.logging.config.file"));
        assertEquals(Level.WARNING, logger.getLevel());
    }
}