Fix bug in PlaceholderTargetSource for null values
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user