X-Git-Url: http://jaekl.net/gitweb/?p=cfb.git;a=blobdiff_plain;f=test%2Fnet%2Fjaekl%2Fcfb%2FCfbBundleTest.java;fp=test%2Fnet%2Fjaekl%2Fcfb%2FCfbBundleTest.java;h=db6a899d790411a1cc94986aeb30f825c58b0182;hp=0000000000000000000000000000000000000000;hb=e6448f6cf67e5a5409f24b531c2443b3bed53b52;hpb=a4a577abc3f9b2b1147caafd1cb39fa8c2622cd4 diff --git a/test/net/jaekl/cfb/CfbBundleTest.java b/test/net/jaekl/cfb/CfbBundleTest.java new file mode 100644 index 0000000..db6a899 --- /dev/null +++ b/test/net/jaekl/cfb/CfbBundleTest.java @@ -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); + } + } + +}