Skip to main content
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorpelder2006-04-12 13:33:30 -0400
committerpelder2006-04-12 13:33:30 -0400
commitaa572e820c746df28d187d7b7d99dc5fbe6a5ed4 (patch)
treefb799bd50721df833b2705debb28884e1c6d3131 /tests
parent5700b13db598b2fec7e15a3ed3049ec998ce5a9f (diff)
downloadorg.eclipse.jet-aa572e820c746df28d187d7b7d99dc5fbe6a5ed4.tar.gz
org.eclipse.jet-aa572e820c746df28d187d7b7d99dc5fbe6a5ed4.tar.xz
org.eclipse.jet-aa572e820c746df28d187d7b7d99dc5fbe6a5ed4.zip
[136392] Add DPTK parity XPath functions and tags.
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/AllTests.java5
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/AllTests.java18
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/FormatContextExtenderTests.java42
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/FormatNowTagTests.java60
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/UuidTagTests.java56
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/AllTests.java28
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/CamelCaseFunctionTests.java42
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/CardinalityFunctionTests.java84
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/ClassNameFunctionTests.java44
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/EscapeJavaWhitespaceFunctionTests.java26
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/LowerCaseFunctionTests.java25
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/LowercaseFirstFunctionTests.java31
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/PackageNameFunctionTests.java44
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/RemoveWhitespaceFunctionTests.java23
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/TrimWhitespaceFunctionTests.java24
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/UpperCaseFirstFunctionTests.java41
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/UpperCaseFunctionTests.java25
-rw-r--r--tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/XMLEncodeFunctionTests.java25
18 files changed, 642 insertions, 1 deletions
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/AllTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/AllTests.java
index 49684c7..4b2fe16 100644
--- a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/AllTests.java
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/AllTests.java
@@ -1,5 +1,6 @@
package org.eclipse.jet.tests;
+
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -8,12 +9,14 @@ public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite("Test for org.eclipse.jet.tests");
suite.addTest(org.eclipse.jet.tests.compiler.AllTests.suite());
- suite.addTest(org.eclipse.jet.tests.runtime.AllTests.suite());
suite.addTest(org.eclipse.jet.tests.xpath.AllTests.suite());
+ suite.addTest(org.eclipse.jet.tests.xpath.functions.extras.AllTests.suite());
suite.addTest(org.eclipse.jet.tests.model.load.AllTests.suite());
suite.addTest(org.eclipse.jet.tests.taglib.AllTests.suite());
suite.addTest(org.eclipse.jet.tests.taglib.control.AllTests.suite());
suite.addTest(org.eclipse.jet.tests.taglib.java.AllTests.suite());
+ suite.addTest(org.eclipse.jet.tests.taglib.format.AllTests.suite());
+ suite.addTest(org.eclipse.jet.tests.runtime.AllTests.suite());
//$JUnit-BEGIN$
//$JUnit-END$
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/AllTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/AllTests.java
new file mode 100644
index 0000000..96f4996
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/AllTests.java
@@ -0,0 +1,18 @@
+package org.eclipse.jet.tests.taglib.format;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.eclipse.jet.tests.taglib.format");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(UuidTagTests.class);
+ suite.addTestSuite(FormatContextExtenderTests.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/FormatContextExtenderTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/FormatContextExtenderTests.java
new file mode 100644
index 0000000..cb3ce9c
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/FormatContextExtenderTests.java
@@ -0,0 +1,42 @@
+package org.eclipse.jet.tests.taglib.format;
+
+import org.eclipse.jet.JET2Context;
+import org.eclipse.jet.internal.taglib.format.FormatContextExtender;
+
+import junit.framework.TestCase;
+
+public class FormatContextExtenderTests extends TestCase {
+
+ private FormatContextExtender fce;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ fce = FormatContextExtender.getInstance(new JET2Context(null));
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /*
+ * Test method for 'org.eclipse.jet.internal.taglib.format.FormatContextExtender.getMilliseconds()'
+ */
+ public void testGetMilliseconds() {
+ final long ms1 = fce.getMilliseconds();
+ assertTrue("positive", ms1 > 0);
+ final long ms2 = fce.getMilliseconds();
+ assertTrue(ms2 > ms1);
+
+ }
+
+ /*
+ * Test method for 'org.eclipse.jet.internal.taglib.format.FormatContextExtender.getUnique()'
+ */
+ public void testGetUnique() {
+ final int unique1 = fce.getUnique();
+ assertEquals(1, unique1);
+ final int unique2 = fce.getUnique();
+ assertEquals(unique1 + 1, unique2);
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/FormatNowTagTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/FormatNowTagTests.java
new file mode 100644
index 0000000..71676a4
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/FormatNowTagTests.java
@@ -0,0 +1,60 @@
+package org.eclipse.jet.tests.taglib.format;
+
+import java.util.Calendar;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jet.BodyContentWriter;
+import org.eclipse.jet.JET2Context;
+import org.eclipse.jet.JET2Writer;
+import org.eclipse.jet.internal.taglib.format.FormatNowTag;
+import org.eclipse.jet.taglib.JET2TagException;
+import org.eclipse.jet.taglib.TagInfo;
+
+public class FormatNowTagTests extends TestCase {
+
+ private JET2Writer out;
+ private FormatNowTag tag;
+ private TagInfo tagInfo;
+ private JET2Context context;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.out = new BodyContentWriter();
+ this.tag = new FormatNowTag();
+ context = new JET2Context(null);
+ tag.setContext(context);
+ tag.setOut(out);
+ tag.setParent(null);
+ tagInfo = new TagInfo("f:formatNow", 1, 1,
+ new String[] {
+ "format"
+ },
+ new String[] {
+ "yyyy.MM.dd.HH.mm"
+ });
+ tag.setTagInfo(tagInfo);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /*
+ * Test method for 'org.eclipse.jet.internal.taglib.format.FormatNowTag.doAction(TagInfo, JET2Context, JET2Writer)'
+ */
+ public void testDoAction() throws JET2TagException {
+ final Calendar now = Calendar.getInstance();
+ tag.doAction(tagInfo, context, out);
+
+ String formatted = out.getDocument().get();
+ final String[] parts = formatted.split("\\.");
+ assertNotNull(parts);
+ assertEquals(5, parts.length);
+ assertEquals(String.valueOf(now.get(Calendar.YEAR)), parts[0]);
+ assertEquals(String.valueOf(now.get(Calendar.MONTH)), parts[1]);
+ assertEquals(String.valueOf(now.get(Calendar.DAY_OF_MONTH)), parts[2]);
+ assertEquals(String.valueOf(now.get(Calendar.HOUR_OF_DAY)), parts[3]);
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/UuidTagTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/UuidTagTests.java
new file mode 100644
index 0000000..3426081
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/taglib/format/UuidTagTests.java
@@ -0,0 +1,56 @@
+package org.eclipse.jet.tests.taglib.format;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jet.BodyContentWriter;
+import org.eclipse.jet.JET2Context;
+import org.eclipse.jet.JET2Writer;
+import org.eclipse.jet.internal.taglib.format.UuidTag;
+import org.eclipse.jet.taglib.JET2TagException;
+import org.eclipse.jet.taglib.TagInfo;
+
+public class UuidTagTests extends TestCase {
+
+ private JET2Writer out;
+ private UuidTag tag;
+ private TagInfo tagInfo;
+ private JET2Context context;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.out = new BodyContentWriter();
+ this.tag = new UuidTag();
+ context = new JET2Context(null);
+ tag.setContext(context);
+ tag.setOut(out);
+ tag.setParent(null);
+ tagInfo = new TagInfo("f:uuid", 1, 1, new String[0], new String[0]);
+ tag.setTagInfo(tagInfo);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /*
+ * Test method for 'org.eclipse.jet.internal.taglib.format.UuidTag.doAction(TagInfo, JET2Context, JET2Writer)'
+ */
+ public void testDoAction() throws JET2TagException {
+ tag.doAction(tagInfo, context, out);
+
+ String uuid1 = out.getDocument().get();
+
+ assertNotNull(uuid1);
+ assertEquals(23, uuid1.length()); // all UUIDs returned by this tag are 23 chars
+ out.getDocument().set("");
+
+ tag.doAction(tagInfo, context, out);
+ String uuid2 = out.getDocument().get();
+ assertNotNull(uuid2);
+ assertEquals(23, uuid2.length()); // all UUIDs returned by this tag are 23 chars
+
+ assertTrue("uuid1 != uuid2", !uuid1.equals(uuid2));
+
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/AllTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/AllTests.java
new file mode 100644
index 0000000..997964b
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/AllTests.java
@@ -0,0 +1,28 @@
+package org.eclipse.jet.tests.xpath.functions.extras;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.eclipse.jet.tests.xpath.functions.extras");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(PackageNameFunctionTests.class);
+ suite.addTestSuite(LowerCaseFunctionTests.class);
+ suite.addTestSuite(CamelCaseFunctionTests.class);
+ suite.addTestSuite(EscapeJavaWhitespaceFunctionTests.class);
+ suite.addTestSuite(UpperCaseFirstFunctionTests.class);
+ suite.addTestSuite(LowercaseFirstFunctionTests.class);
+ suite.addTestSuite(CardinalityFunctionTests.class);
+ suite.addTestSuite(UpperCaseFunctionTests.class);
+ suite.addTestSuite(XMLEncodeFunctionTests.class);
+ suite.addTestSuite(ClassNameFunctionTests.class);
+ suite.addTestSuite(TrimWhitespaceFunctionTests.class);
+ suite.addTestSuite(RemoveWhitespaceFunctionTests.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/CamelCaseFunctionTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/CamelCaseFunctionTests.java
new file mode 100644
index 0000000..5daefcd
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/CamelCaseFunctionTests.java
@@ -0,0 +1,42 @@
+package org.eclipse.jet.tests.xpath.functions.extras;
+
+import java.util.Collections;
+
+import org.eclipse.jet.internal.xpath.functions.extras.CamelCaseFunction;
+
+import junit.framework.TestCase;
+
+public class CamelCaseFunctionTests extends TestCase {
+
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.functions.extras.CamelCaseFunction.evaluate(List)'
+ */
+ public void testEvaluate() {
+ String arg = "hello world";
+ final Object result = doFunction(arg);
+ assertEquals("HelloWorld", result);
+
+ }
+
+ public void testEvaluate_alreadyCC() {
+ String arg = "JETWriter";
+ final Object result = doFunction(arg);
+ assertEquals("Jetwriter", result);
+ }
+
+ public void testEvaluate_withIllegalChars() {
+ String arg = "dots.are.not.allowed";
+ final Object result = doFunction(arg);
+ assertEquals("Dotsarenotallowed", result);
+ }
+
+ /**
+ * @param arg
+ * @return
+ */
+ private Object doFunction(String arg) {
+ final Object result = new CamelCaseFunction().evaluate(Collections.singletonList(arg));
+ return result;
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/CardinalityFunctionTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/CardinalityFunctionTests.java
new file mode 100644
index 0000000..807a193
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/CardinalityFunctionTests.java
@@ -0,0 +1,84 @@
+package org.eclipse.jet.tests.xpath.functions.extras;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jet.internal.xpath.NodeSetImpl;
+import org.eclipse.jet.internal.xpath.functions.extras.CardinalityFunction;
+import org.eclipse.jet.xpath.NodeSet;
+
+public class CardinalityFunctionTests extends TestCase {
+
+ private final NodeSet emptyNodeSet;
+ private final NodeSet singletonNodeSet;
+ private final NodeSet binaryNodeSet;
+
+ public CardinalityFunctionTests() {
+ emptyNodeSet = new NodeSetImpl();
+
+ singletonNodeSet = new NodeSetImpl();
+ singletonNodeSet.add("one");
+
+ binaryNodeSet = new NodeSetImpl();
+ binaryNodeSet.add("one");
+ binaryNodeSet.add("two");
+ }
+
+ private boolean doFunction(NodeSet nodeSet, String cardTest) {
+ List args = new ArrayList();
+ args.add(nodeSet);
+ args.add(cardTest);
+ return ((Boolean)new CardinalityFunction().evaluate(args)).booleanValue();
+ }
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.functions.extras.CardinalityFunction.evaluate(List)'
+ */
+ public void testEvaluate_1() {
+ final String testCardinality = "1";
+ final boolean emptyResult = doFunction(emptyNodeSet, testCardinality);
+ final boolean singletonResult = doFunction(singletonNodeSet, testCardinality);
+ final boolean binaryResult = doFunction(binaryNodeSet, testCardinality);
+
+ assertFalse("emptyResult", emptyResult);
+ assertTrue("singletonResult", singletonResult);
+ assertFalse("binaryResult", binaryResult);
+ }
+
+ public void testEvaluate_0() {
+ final String testCardinality = "0";
+ final boolean emptyResult = doFunction(emptyNodeSet, testCardinality);
+ final boolean singletonResult = doFunction(singletonNodeSet, testCardinality);
+ final boolean binaryResult = doFunction(binaryNodeSet, testCardinality);
+
+ assertTrue("emptyResult", emptyResult);
+ assertFalse("singletonResult", singletonResult);
+ assertFalse("binaryResult", binaryResult);
+ }
+
+ public void testEvaluate_m() {
+ final String testCardinality = "m";
+ final boolean emptyResult = doFunction(emptyNodeSet, testCardinality);
+ final boolean singletonResult = doFunction(singletonNodeSet, testCardinality);
+ final boolean binaryResult = doFunction(binaryNodeSet, testCardinality);
+
+ assertFalse("emptyResult", emptyResult);
+ assertFalse("singletonResult", singletonResult);
+ assertTrue("binaryResult", binaryResult);
+ }
+
+ public void testEvaluate_1m() {
+ final String testCardinality = "1m";
+ final boolean emptyResult = doFunction(emptyNodeSet, testCardinality);
+ final boolean singletonResult = doFunction(singletonNodeSet, testCardinality);
+ final boolean binaryResult = doFunction(binaryNodeSet, testCardinality);
+
+ assertFalse("emptyResult", emptyResult);
+ assertTrue("singletonResult", singletonResult);
+ assertTrue("binaryResult", binaryResult);
+ }
+
+
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/ClassNameFunctionTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/ClassNameFunctionTests.java
new file mode 100644
index 0000000..c3846e2
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/ClassNameFunctionTests.java
@@ -0,0 +1,44 @@
+package org.eclipse.jet.tests.xpath.functions.extras;
+
+import java.util.Collections;
+
+import org.eclipse.jet.internal.xpath.functions.extras.ClassNameFunction;
+
+import junit.framework.TestCase;
+
+public class ClassNameFunctionTests extends TestCase {
+
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.functions.extras.ClassNameFunction.evaluate(List)'
+ */
+ public void testEvaluate() {
+ String arg = "a.b.c.MyClass";
+ final Object result = doFunction(arg);
+
+ assertEquals("MyClass", result);
+ }
+
+ public void testEvaluate_defaultPackage() {
+ String arg = "MyClass";
+ final Object result = doFunction(arg);
+
+ assertEquals("MyClass", result);
+ }
+
+ public void testEvaluate_empty() {
+ String arg = "";
+ final Object result = doFunction(arg);
+
+ assertEquals("", result);
+ }
+
+ /**
+ * @param arg
+ * @return
+ */
+ private Object doFunction(String arg) {
+ final Object result = new ClassNameFunction().evaluate(Collections.singletonList(arg));
+ return result;
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/EscapeJavaWhitespaceFunctionTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/EscapeJavaWhitespaceFunctionTests.java
new file mode 100644
index 0000000..cee9ba8
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/EscapeJavaWhitespaceFunctionTests.java
@@ -0,0 +1,26 @@
+package org.eclipse.jet.tests.xpath.functions.extras;
+
+import java.util.Collections;
+
+import org.eclipse.jet.internal.xpath.functions.extras.EscapeJavaWhitespaceFunction;
+
+import junit.framework.TestCase;
+
+public class EscapeJavaWhitespaceFunctionTests extends TestCase {
+
+
+ private String doFunction(String arg) {
+ return (String) new EscapeJavaWhitespaceFunction().evaluate(Collections.singletonList(arg));
+ }
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.functions.extras.EscapeJavaWhitespaceFunction.evaluate(List)'
+ */
+ public void testEvaluate() {
+ String arg = "r:\r n:\n t:\t b:\b f:\f slash:\\ quote:\"";
+ final String result = doFunction(arg);
+
+ assertEquals("r:\\r n:\\n t:\\t b:\\b f:\\f slash:\\\\ quote:\\\"", result);
+
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/LowerCaseFunctionTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/LowerCaseFunctionTests.java
new file mode 100644
index 0000000..90b286d
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/LowerCaseFunctionTests.java
@@ -0,0 +1,25 @@
+package org.eclipse.jet.tests.xpath.functions.extras;
+
+import java.util.Collections;
+
+import org.eclipse.jet.internal.xpath.functions.extras.Lower_caseFunction;
+
+import junit.framework.TestCase;
+
+public class LowerCaseFunctionTests extends TestCase {
+
+ private String doFunction(String arg) {
+ return (String)new Lower_caseFunction().evaluate(Collections.singletonList(arg));
+ }
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.functions.extras.Lower_caseFunction.evaluate(List)'
+ */
+ public void testEvaluate() {
+ String arg = "AbCdEfGhIjKlMnOpQrStUvWxYz";
+
+ final String result = doFunction(arg);
+ assertEquals("abcdefghijklmnopqrstuvwxyz", result);
+
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/LowercaseFirstFunctionTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/LowercaseFirstFunctionTests.java
new file mode 100644
index 0000000..c40d086
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/LowercaseFirstFunctionTests.java
@@ -0,0 +1,31 @@
+package org.eclipse.jet.tests.xpath.functions.extras;
+
+import java.util.Collections;
+
+import org.eclipse.jet.internal.xpath.functions.extras.LowercaseFirstFunction;
+
+import junit.framework.TestCase;
+
+public class LowercaseFirstFunctionTests extends TestCase {
+
+ private String doFunction(String arg) {
+ return (String) new LowercaseFirstFunction().evaluate(Collections.singletonList(arg));
+ }
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.functions.extras.LowercaseFirstFunction.evaluate(List)'
+ */
+ public void testEvaluate() {
+ String arg = "ABC";
+ final String result = doFunction(arg);
+ assertEquals("aBC", result);
+
+ }
+
+ public void testEvaluate_empty() {
+ String arg = "";
+ final String result = doFunction(arg);
+ assertEquals("", result);
+
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/PackageNameFunctionTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/PackageNameFunctionTests.java
new file mode 100644
index 0000000..679412f
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/PackageNameFunctionTests.java
@@ -0,0 +1,44 @@
+package org.eclipse.jet.tests.xpath.functions.extras;
+
+import java.util.Collections;
+
+import org.eclipse.jet.internal.xpath.functions.extras.PackageNameFunction;
+
+import junit.framework.TestCase;
+
+public class PackageNameFunctionTests extends TestCase {
+
+ private String doFunction(String arg) {
+ return (String) new PackageNameFunction().evaluate(Collections.singletonList(arg));
+ }
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.functions.extras.PackageNameFunction.evaluate(List)'
+ */
+ public void testEvaluate() {
+
+ String arg = "a.b.c.d.MyClass";
+
+ final String result = doFunction(arg);
+
+ assertEquals("a.b.c.d", result);
+ }
+
+ public void testEvaluate_defaultPackage() {
+
+ String arg = "MyClass";
+
+ final String result = doFunction(arg);
+
+ assertEquals("", result);
+ }
+
+ public void testEvaluate_empty() {
+
+ String arg = "";
+
+ final String result = doFunction(arg);
+
+ assertEquals("", result);
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/RemoveWhitespaceFunctionTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/RemoveWhitespaceFunctionTests.java
new file mode 100644
index 0000000..4044d55
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/RemoveWhitespaceFunctionTests.java
@@ -0,0 +1,23 @@
+package org.eclipse.jet.tests.xpath.functions.extras;
+
+import java.util.Collections;
+
+import org.eclipse.jet.internal.xpath.functions.extras.RemoveWhitespaceFunction;
+
+import junit.framework.TestCase;
+
+public class RemoveWhitespaceFunctionTests extends TestCase {
+
+ private String doFunction(String arg) {
+ return (String) new RemoveWhitespaceFunction().evaluate(Collections.singletonList(arg));
+ }
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.functions.extras.RemoveWhitespaceFunction.evaluate(List)'
+ */
+ public void testEvaluate() {
+ String arg = " This is a long sentence\t that must be\r\n stripped ";
+ final String result = doFunction(arg);
+ assertEquals("Thisisalongsentencethatmustbestripped", result);
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/TrimWhitespaceFunctionTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/TrimWhitespaceFunctionTests.java
new file mode 100644
index 0000000..feab2d5
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/TrimWhitespaceFunctionTests.java
@@ -0,0 +1,24 @@
+package org.eclipse.jet.tests.xpath.functions.extras;
+
+import java.util.Collections;
+
+import org.eclipse.jet.internal.xpath.functions.extras.TrimWhitespaceFunction;
+
+import junit.framework.TestCase;
+
+public class TrimWhitespaceFunctionTests extends TestCase {
+
+ private String doFunction(String arg) {
+ return (String) new TrimWhitespaceFunction().evaluate(Collections.singletonList(arg));
+ }
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.functions.extras.TrimWhitespaceFunction.evaluate(List)'
+ */
+ public void testEvaluate() {
+ String arg = " \t\r\n First word and last word \r\n\t ";
+ final String result = doFunction(arg);
+
+ assertEquals("First word and last word", result);
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/UpperCaseFirstFunctionTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/UpperCaseFirstFunctionTests.java
new file mode 100644
index 0000000..cdac3d1
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/UpperCaseFirstFunctionTests.java
@@ -0,0 +1,41 @@
+package org.eclipse.jet.tests.xpath.functions.extras;
+
+import java.util.Collections;
+
+import org.eclipse.jet.internal.xpath.functions.extras.UppercaseFirstFunction;
+
+import junit.framework.TestCase;
+
+public class UpperCaseFirstFunctionTests extends TestCase {
+
+ private String doFunction(String arg) {
+ return (String) new UppercaseFirstFunction().evaluate(Collections.singletonList(arg));
+ }
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.functions.extras.UppercaseFirstFunction.evaluate(List)'
+ */
+ public void testEvaluate() {
+
+ String arg = "abc";
+ final String result = doFunction(arg);
+
+ assertEquals("Abc", result);
+ }
+
+ public void testEvaluate_single() {
+
+ String arg = "a";
+ final String result = doFunction(arg);
+
+ assertEquals("A", result);
+ }
+
+ public void testEvaluate_empty() {
+
+ String arg = "";
+ final String result = doFunction(arg);
+
+ assertEquals("", result);
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/UpperCaseFunctionTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/UpperCaseFunctionTests.java
new file mode 100644
index 0000000..653a6c6
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/UpperCaseFunctionTests.java
@@ -0,0 +1,25 @@
+package org.eclipse.jet.tests.xpath.functions.extras;
+
+import java.util.Collections;
+
+import org.eclipse.jet.internal.xpath.functions.extras.Upper_caseFunction;
+
+import junit.framework.TestCase;
+
+public class UpperCaseFunctionTests extends TestCase {
+
+ private String doFunction(String arg) {
+ return (String) new Upper_caseFunction().evaluate(Collections.singletonList(arg));
+ }
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.functions.extras.Upper_caseFunction.evaluate(List)'
+ */
+ public void testEvaluate() {
+ String arg = "a b c d e f g";
+ final String result = doFunction(arg);
+
+ assertEquals("A B C D E F G", result);
+
+ }
+
+}
diff --git a/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/XMLEncodeFunctionTests.java b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/XMLEncodeFunctionTests.java
new file mode 100644
index 0000000..e0f3e04
--- /dev/null
+++ b/tests/org.eclipse.jet.tests/src/org/eclipse/jet/tests/xpath/functions/extras/XMLEncodeFunctionTests.java
@@ -0,0 +1,25 @@
+package org.eclipse.jet.tests.xpath.functions.extras;
+
+import java.util.Collections;
+
+import org.eclipse.jet.internal.xpath.functions.extras.XmlEncodeFunction;
+
+import junit.framework.TestCase;
+
+public class XMLEncodeFunctionTests extends TestCase {
+
+ private String doFunction(String arg) {
+ return (String) new XmlEncodeFunction().evaluate(Collections.singletonList(arg));
+ }
+ /*
+ * Test method for 'org.eclipse.jet.internal.xpath.functions.extras.XmlEncodeFunction.evaluate(List)'
+ */
+ public void testEvaluate() {
+ String arg = "<a b=\"xxx\" c='xxx'/> &";
+ final String result = doFunction(arg);
+
+ assertEquals("&lt;a b=&quot;xxx&quot; c=&apos;xxx&apos;/&gt; &amp;", result);
+
+ }
+
+}

Back to the top