From d1f16069600674d7fefb932f390442608b2f6afc Mon Sep 17 00:00:00 2001 From: "Gary D. Gregory" Date: Mon, 25 Jul 2005 16:43:07 +0000 Subject: [PATCH] Another new boundary tests for VariableFormatterTest.java: testReplaceEmptyKeys. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@225152 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/lang/text/VariableFormatterTest.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/test/org/apache/commons/lang/text/VariableFormatterTest.java b/src/test/org/apache/commons/lang/text/VariableFormatterTest.java index e653e8b19..c101ebe18 100644 --- a/src/test/org/apache/commons/lang/text/VariableFormatterTest.java +++ b/src/test/org/apache/commons/lang/text/VariableFormatterTest.java @@ -37,6 +37,8 @@ public class VariableFormatterTest extends TestCase { static final String REPLACE_TEMPLATE = "The ${animal} jumps over the ${target}."; + static final String REPLACE_TEMPLATE_EMPTY_KEYS = "The ${} jumps over the ${}."; + static final String REPLACE_TEMPLATE_NO_ESCAPE = "The {animal} jumps over the {target}."; static final String REPLACE_TEMPLATE_NO_MARKERS = "The animal jumps over the target."; @@ -248,12 +250,24 @@ public class VariableFormatterTest extends TestCase { } /** - * Tests a replace template with missing prefix strings. + * Tests a replace template with missing marker strings. */ public void testReplaceNoMarkers() { testReplaceNoElement(REPLACE_TEMPLATE_NO_MARKERS); } + /** + * Tests a replace template with missing empty marker strings. + */ + public void testReplaceEmptyKeys() { + try { + testReplaceNoElement(REPLACE_TEMPLATE_EMPTY_KEYS); + fail("Expected IllegalStateException."); + } catch (IllegalStateException e) { + // expected for now. + } + } + /** * Tests a replace template with missing postfix strings. */