Clean up error handling to make things slightly friendlier on an initial install.
[cfb.git] / test / net / jaekl / cfb / CfbBundleTest.java
diff --git a/test/net/jaekl/cfb/CfbBundleTest.java b/test/net/jaekl/cfb/CfbBundleTest.java
new file mode 100644 (file)
index 0000000..db6a899
--- /dev/null
@@ -0,0 +1,33 @@
+package net.jaekl.cfb;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class CfbBundleTest {
+
+       @Test
+       public void testFallbackGet() {
+               Object[][] data = {
+                               { "hello", new Object[] {}, "[hello]" },
+                               { "hello", new Object[] {"world"}, "[hello][world]"},
+                               { null, new Object[] {}, "[null]" },
+                               { 
+                                       "the.quick.brown.fox", 
+                                       new Object[] {"jumps.over", Integer.valueOf(1), "lazy", "dog"}, 
+                                       "[the.quick.brown.fox][jumps.over][1][lazy][dog]"
+                               }
+                       };
+               
+               CfbBundleMock bundle = new CfbBundleMock();
+               
+               for (Object[] datum : data) {
+                       String key = (String)datum[0];
+                       Object[] params = (Object[])datum[1];
+                       String expected = (String)datum[2];
+                       String actual = bundle.fallbackGet(key, params);
+                       assertEquals(expected, actual);
+               }
+       }
+
+}