Fix bug in PlaceholderTargetSource for null values

This commit is contained in:
dsyer
2008-12-11 19:05:59 +00:00
parent e8ef2ae31d
commit a6b6af9327
3 changed files with 28 additions and 1 deletions

View File

@@ -38,6 +38,10 @@ public class PlaceholderTargetSourceTests extends ContextFactorySupport {
@Qualifier("withDate")
private PlaceholderTargetSource withDate;
@Autowired
@Qualifier("withNull")
private PlaceholderTargetSource withNull;
@Autowired
@Qualifier("compound")
private PlaceholderTargetSource compound;
@@ -82,6 +86,10 @@ public class PlaceholderTargetSourceTests extends ContextFactorySupport {
return date;
}
public String getGarbage() {
return null;
}
@Test
public void testAfterPropertiesSet() throws Exception {
PlaceholderTargetSource targetSource = new PlaceholderTargetSource();
@@ -143,6 +151,13 @@ public class PlaceholderTargetSourceTests extends ContextFactorySupport {
assertEquals("bar-#{date}", target.getName());
}
@Test
public void testGetNull() {
Node target = (Node) withNull.getTarget();
// Remains unconverted because null is explicitly excluded
assertEquals("bar-#{garbage}", target.getName());
}
public static interface Node {
String getName();