forked from loafle/openapi-generator-original
udpate global setting tests (#20925)
This commit is contained in:
parent
69e4336f67
commit
8a8bacd0d5
@ -2,35 +2,37 @@ package org.openapitools.codegen.config;
|
|||||||
|
|
||||||
import ch.qos.logback.classic.Level;
|
import ch.qos.logback.classic.Level;
|
||||||
import ch.qos.logback.classic.Logger;
|
import ch.qos.logback.classic.Logger;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.assertj.core.api.Assertions.assertThatNoException;
|
import static org.assertj.core.api.Assertions.assertThatNoException;
|
||||||
|
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.testng.annotations.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for {@link GlobalSettings}
|
* Test class for {@link GlobalSettings}
|
||||||
|
*
|
||||||
* @author Edoardo Patti
|
* @author Edoardo Patti
|
||||||
*/
|
*/
|
||||||
public class GlobalSettingsTest {
|
public class GlobalSettingsTest {
|
||||||
|
|
||||||
private static final Object OBJECT = new Object();
|
@BeforeClass
|
||||||
|
public void setUp() {
|
||||||
|
((Logger) LoggerFactory.getLogger(GlobalSettings.class)).setLevel(Level.DEBUG);
|
||||||
|
Properties props = new Properties(2);
|
||||||
|
props.put("test1", 789);
|
||||||
|
props.put(345, "test2");
|
||||||
|
System.getProperties().putAll(props);
|
||||||
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@Test
|
||||||
public void setUp() {
|
public void testNonStringSystemProperties() {
|
||||||
((Logger) LoggerFactory.getLogger(GlobalSettings.class)).setLevel(Level.DEBUG);
|
assertThat(GlobalSettings.getProperty("345")).isEqualTo("test2");
|
||||||
Properties props = new Properties(2);
|
assertThat(GlobalSettings.getProperty("test1")).isEqualTo("789");
|
||||||
props.put("test1", OBJECT);
|
assertThatNoException().isThrownBy(GlobalSettings::log);
|
||||||
props.put(OBJECT, "test2");
|
}
|
||||||
System.getProperties().putAll(props);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testNonStringSystemProperties() {
|
|
||||||
assertThat(GlobalSettings.getProperty(OBJECT.toString())).isNotNull();
|
|
||||||
assertThat(GlobalSettings.getProperty("test1")).isNotNull();
|
|
||||||
assertThatNoException().isThrownBy(GlobalSettings::log);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user