Skip to content

Commit 8a8bacd

Browse files
authored
udpate global setting tests (#20925)
1 parent 69e4336 commit 8a8bacd

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

modules/openapi-generator/src/test/java/org/openapitools/codegen/config/GlobalSettingsTest.java

+19-17
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,37 @@
22

33
import ch.qos.logback.classic.Level;
44
import ch.qos.logback.classic.Logger;
5+
56
import java.util.Properties;
7+
68
import static org.assertj.core.api.Assertions.assertThat;
79
import static org.assertj.core.api.Assertions.assertThatNoException;
10+
811
import org.slf4j.LoggerFactory;
912
import org.testng.annotations.BeforeClass;
1013
import org.testng.annotations.Test;
1114

1215
/**
1316
* Test class for {@link GlobalSettings}
17+
*
1418
* @author Edoardo Patti
1519
*/
1620
public class GlobalSettingsTest {
1721

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+
}
3537

3638
}

0 commit comments

Comments
 (0)