View Javadoc
1   package ch.qos.logback.classic.util;
2   
3   import ch.qos.logback.core.util.EnvUtil;
4   import org.junit.jupiter.api.BeforeEach;
5   import org.junit.jupiter.api.Test;
6   
7   import static org.junit.jupiter.api.Assertions.assertNotNull;
8   import static org.junit.jupiter.api.Assertions.assertTrue;
9   public class EnvUtilTest {
10  
11      // Beware: ----------------------------------------
12      // Beware:  needs to be updated upon version change
13      // Beware: ----------------------------------------
14      static final String EXPECTED_VERSION = "1.5";
15  
16  
17      @BeforeEach
18      public void setUp() throws Exception {
19  
20      }
21  
22      // this test runs fine if run from logback-classic but fails when
23      // run from logback-core. This is due to the fact that package information
24      // is added when creating the jar.
25      @Test
26      public void versionTest() {
27          String versionStr = EnvUtil.logbackVersion();
28          assertNotNull(versionStr);
29          assertTrue(versionStr.startsWith(EXPECTED_VERSION));
30      }
31  
32  
33  
34  }