]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
9f1f4053355046ba809c02162fa7bea06535080a
[tmp/jakarta-migration.git] /
1 package org.collectionspace.services.id.part.test;
2
3 import org.collectionspace.services.id.part.GregorianDateIDPart;
4
5 import org.testng.Assert;
6 import org.testng.annotations.Test;
7
8 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory;
10
11 public class GregorianDateIDPartTest {
12
13     final Logger logger =
14         LoggerFactory.getLogger(GregorianDateIDPartTest.class);
15
16     GregorianDateIDPart part;
17
18     @Test
19     public void newID() {
20
21         // @TODO Replace these hard-coded expedients, which will all fail
22         // when the current month or year doesn't match these asserted values.
23         
24         part = new GregorianDateIDPart("yyyy");
25         Assert.assertEquals(part.newID(), "2009");
26
27         part = new GregorianDateIDPart("M");
28         Assert.assertEquals(part.newID(), "11");
29
30         part = new GregorianDateIDPart("MMMM");
31         Assert.assertEquals(part.newID(), "November");
32
33         part = new GregorianDateIDPart("MMMM", "fr");
34         // Month names are not capitalized in French.
35         Assert.assertEquals(part.newID(), "novembre");
36         
37     }
38
39
40     @Test
41     public void format() {
42     }
43
44     @Test
45     public void isValid() {
46         part = new GregorianDateIDPart("yyyy");
47         Assert.assertTrue(part.getValidator().isValid(part.newID()));
48     }
49
50 }