-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from orphan-oss/OGNL-102-performance
OGNL-102 Improves performance when null was returned
- Loading branch information
Showing
8 changed files
with
348 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package ognl.test; | ||
|
||
import ognl.Ognl; | ||
import ognl.OgnlContext; | ||
import org.junit.Test; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static org.junit.Assert.assertNull; | ||
|
||
public class NullRootTest { | ||
|
||
@Test | ||
public void testNullValue() throws Exception { | ||
OgnlContext context = Ognl.createDefaultContext(null); | ||
Map<String, Object> root = new HashMap<>(); | ||
root.put("key1", null); | ||
String expr = "key1.key2.key3"; | ||
assertNull(Ognl.getValue(expr, context, root)); | ||
} | ||
|
||
@Test | ||
public void testEmptyRoot() throws Exception { | ||
OgnlContext context = Ognl.createDefaultContext(null); | ||
Map<String, Object> root = new HashMap<>(); | ||
String expr = "key1.key2.key3"; | ||
assertNull(Ognl.getValue(expr, context, root)); | ||
} | ||
|
||
@Test | ||
public void testNullRoot() throws Exception { | ||
OgnlContext context = Ognl.createDefaultContext(null); | ||
Map<String, Object> root = null; | ||
String expr = "key1.key2.key3"; | ||
assertNull(Ognl.getValue(expr, context, root)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.