Author: ssolsagl
Date: 2006-11-23 11:03:12 +0100 (Thu, 23 Nov 2006)
New Revision: 4010
Added:
trunk/core-api/src/test/java/no/schibstedsok/searchportal/view/velocity/
trunk/core-api/src/test/java/no/schibstedsok/searchportal/view/velocity/ShareHoldersDirectiveTest.java
Log:
test class
Added:
trunk/core-api/src/test/java/no/schibstedsok/searchportal/view/velocity/ShareHoldersDirectiveTest.java
===================================================================
---
trunk/core-api/src/test/java/no/schibstedsok/searchportal/view/velocity/ShareHoldersDirectiveTest.java
(rev 0)
+++
trunk/core-api/src/test/java/no/schibstedsok/searchportal/view/velocity/ShareHoldersDirectiveTest.java
2006-11-23 10:03:12 UTC (rev 4010)
@@ -0,0 +1,68 @@
+package no.schibstedsok.searchportal.view.velocity;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+
+
+public class ShareHoldersDirectiveTest extends TestCase {
+
+ public ShareHoldersDirectiveTest(String testName) {
+ super(testName);
+ }
+
+ /**
+ * Test the parse 3 share holders
+ */
+ public void testParsing() {
+
+ String ypRoles = "#aksjonaer0##sepnl#\n " +
+ "#bold#Navn#sep#Eierandel i %#sep#Antall aksjer#sepnl#\n" +
+ "STENSENTERET AS#id#2703596#sep#50#sep#100#sepnl#\n" +
+ "ARILD C. GUSTAVSEN#id##sep#25#sep#50#sepnl#\n" +
+ "INGER A. O. GUSTAVSEN#id##sep#25#sep#50#sepnl#\n\n\n";
+
+ ShareHoldersDirective shd = new ShareHoldersDirective();
+ List shareHolders = shd.parse(ypRoles);
+ assert shareHolders.size() == 3;
+
+ }
+
+ /**
+ * Test parse null string
+ */
+
+ public void testParsing2() {
+ ShareHoldersDirective shd = new ShareHoldersDirective();
+ List shareHolders = shd.parse(null);
+ assert shareHolders.size () == 0;
+
+ }
+
+ /**
+ * Test parse empty string
+ */
+
+ public void testParstingEmpty () {
+ ShareHoldersDirective shd = new ShareHoldersDirective();
+ List shareHolders = shd.parse("");
+ assert shareHolders.size () == 0;
+ }
+
+ /**
+ * Try to parse crappy data
+ *
+ */
+ public void testParseRandomString() {
+ String ypRoles = "#aksjonaer0##sepnl#\n " +
+ "#bold#Navn#sep#Eierandel i %#sep#Antall aksjer#sepnl#\n" +
+ "STENSENTERET AS#id#27035950#sep#100#sepnl#\n" +
+ "ARILD C. GUSTAVSEN#id##sep#25#sep#50" +
+ "INGER A. O. GUSTAVSEN#sep#25#sep#50#sepnl#\n\n\n";
+ ShareHoldersDirective shd = new ShareHoldersDirective();
+ List shareHolders = shd.parse(ypRoles);
+ assert shareHolders.size () == 0;
+
+ }
+}
_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits