Skip to content

Commit a69a1e1

Browse files
authored
Merge pull request #165 from kazuki43zoo/polishing-test
Add test for configurationProperties on SqlSessionFactoryBean
2 parents e062399 + 6f069d9 commit a69a1e1

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/test/java/org/mybatis/spring/SqlSessionFactoryBeanTest.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,26 @@ public void testEmptyStringEnvironment() throws Exception {
116116
}
117117

118118
@Test
119-
public void testNullConfiguration() throws Exception {
119+
public void testDefaultConfiguration() throws Exception {
120120
setupFactoryBean();
121121

122-
factoryBean.setConfigLocation(null);
123-
124122
assertDefaultConfig(factoryBean.getObject());
125123
}
126124

125+
@Test
126+
public void testDefaultConfigurationWithConfigurationProperties() throws Exception {
127+
setupFactoryBean();
128+
129+
Properties configurationProperties = new Properties();
130+
configurationProperties.put("username", "dev");
131+
factoryBean.setConfigurationProperties(configurationProperties);
132+
133+
SqlSessionFactory factory = factoryBean.getObject();
134+
assertConfig(factory, SpringManagedTransactionFactory.class);
135+
assertEquals(1, factory.getConfiguration().getVariables().size());
136+
assertEquals("dev", factory.getConfiguration().getVariables().get("username"));
137+
}
138+
127139
@Test
128140
public void testSetConfiguration() throws Exception {
129141
setupFactoryBean();

0 commit comments

Comments
 (0)