Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,37 @@

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;

import java.util.Properties;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatNoException;

import org.slf4j.LoggerFactory;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

/**
* Test class for {@link GlobalSettings}
*
* @author Edoardo Patti
*/
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", OBJECT);
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);
}
@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);
}

@Test
public void testNonStringSystemProperties() {
assertThat(GlobalSettings.getProperty("345")).isEqualTo("test2");
assertThat(GlobalSettings.getProperty("test1")).isEqualTo("789");
assertThatNoException().isThrownBy(GlobalSettings::log);
}

}
Loading