use of cn.hutool.setting.dialect.Props in project hutool by looly.
the class PropsTest method toBeanTest.
@Test
public void toBeanTest() {
Props props = Props.getProp("to_bean_test.properties");
ConfigProperties cfg = props.toBean(ConfigProperties.class, "mail");
Assert.assertEquals("mailer@mail.com", cfg.getHost());
Assert.assertEquals(9000, cfg.getPort());
Assert.assertEquals("mailer@mail.com", cfg.getFrom());
Assert.assertEquals("john", cfg.getCredentials().getUsername());
Assert.assertEquals("password", cfg.getCredentials().getPassword());
Assert.assertEquals("SHA1", cfg.getCredentials().getAuthMethod());
Assert.assertEquals("true", cfg.getAdditionalHeaders().get("redelivery"));
Assert.assertEquals("true", cfg.getAdditionalHeaders().get("secure"));
Assert.assertEquals("admin@mail.com", cfg.getDefaultRecipients().get(0));
Assert.assertEquals("owner@mail.com", cfg.getDefaultRecipients().get(1));
}
use of cn.hutool.setting.dialect.Props in project hutool by looly.
the class PropsTest method propTest.
@Test
public void propTest() {
// noinspection MismatchedQueryAndUpdateOfCollection
Props props = new Props("test.properties");
String user = props.getProperty("user");
Assert.assertEquals(user, "root");
String driver = props.getStr("driver");
Assert.assertEquals(driver, "com.mysql.jdbc.Driver");
}
Aggregations