01: package org.andromda.utils;
02:
03: import junit.framework.TestCase;
04:
05: public class DateUtilsHelperTest extends TestCase {
06: public DateUtilsHelperTest(String name) {
07: super (name);
08: }
09:
10: public void testJavaToPerlFormat() throws Exception {
11: final String[][] fixture = new String[][] {
12: new String[] { "yyyy/MM/dd", "%Y/%m/%d" },
13: new String[] { "dddd/MM/yyyy HH:mm:ss",
14: "%A/%m/%Y %H:%M:%S" },
15: new String[] { "yy-MMMM-ddd", "%y-%B-%a" } };
16:
17: for (int i = 0; i < fixture.length; i++) {
18: String[] strings = fixture[i];
19: assertEquals(DateUtilsHelper.formatJavaToPerl(strings[0]),
20: strings[1]);
21: }
22: }
23:
24: public void testContainsTimeFormat() throws Exception {
25: final Object[][] fixture = new Object[][] {
26: new Object[] { "%Y/%m/%d", Boolean.FALSE },
27: new Object[] { "%A/%m/%Y %H:%M:%S", Boolean.TRUE },
28: new Object[] { "%y-%B-%a", Boolean.FALSE } };
29:
30: for (int i = 0; i < fixture.length; i++) {
31: Object[] objects = fixture[i];
32: assertEquals(Boolean.valueOf(DateUtilsHelper
33: .containsTimeFormat((String) objects[0])),
34: objects[1]);
35: }
36: }
37: }
|