2
2
3
3
import ch .qos .logback .classic .Level ;
4
4
import ch .qos .logback .classic .Logger ;
5
+
5
6
import java .util .Properties ;
7
+
6
8
import static org .assertj .core .api .Assertions .assertThat ;
7
9
import static org .assertj .core .api .Assertions .assertThatNoException ;
10
+
8
11
import org .slf4j .LoggerFactory ;
9
12
import org .testng .annotations .BeforeClass ;
10
13
import org .testng .annotations .Test ;
11
14
12
15
/**
13
16
* Test class for {@link GlobalSettings}
17
+ *
14
18
* @author Edoardo Patti
15
19
*/
16
20
public class GlobalSettingsTest {
17
21
18
- private static final Object OBJECT = new Object ();
19
-
20
- @ BeforeClass
21
- public void setUp () {
22
- ((Logger ) LoggerFactory .getLogger (GlobalSettings .class )).setLevel (Level .DEBUG );
23
- Properties props = new Properties (2 );
24
- props .put ("test1" , OBJECT );
25
- props .put (OBJECT , "test2" );
26
- System .getProperties ().putAll (props );
27
- }
28
-
29
- @ Test
30
- public void testNonStringSystemProperties () {
31
- assertThat (GlobalSettings .getProperty (OBJECT .toString ())).isNotNull ();
32
- assertThat (GlobalSettings .getProperty ("test1" )).isNotNull ();
33
- assertThatNoException ().isThrownBy (GlobalSettings ::log );
34
- }
22
+ @ BeforeClass
23
+ public void setUp () {
24
+ ((Logger ) LoggerFactory .getLogger (GlobalSettings .class )).setLevel (Level .DEBUG );
25
+ Properties props = new Properties (2 );
26
+ props .put ("test1" , 789 );
27
+ props .put (345 , "test2" );
28
+ System .getProperties ().putAll (props );
29
+ }
30
+
31
+ @ Test
32
+ public void testNonStringSystemProperties () {
33
+ assertThat (GlobalSettings .getProperty ("345" )).isEqualTo ("test2" );
34
+ assertThat (GlobalSettings .getProperty ("test1" )).isEqualTo ("789" );
35
+ assertThatNoException ().isThrownBy (GlobalSettings ::log );
36
+ }
35
37
36
38
}
0 commit comments