1   package com.sri.emo.annotations;
2   
3   import java.util.Calendar;
4   import java.util.Date;
5   import java.util.Locale;
6   import com.jcorporate.expresso.core.db.DBException;
7   import junit.framework.TestCase;
8   
9   /***
10   * Test case for node tags.
11   * @author Michael Rimov
12   */
13  public class NodeTagsTestCase extends TestCase {
14      private NodeTag nodeTags = null;
15  
16      protected void setUp() throws Exception {
17          super.setUp();
18          nodeTags = new NodeTag();
19      }
20  
21      protected void tearDown() throws Exception {
22          nodeTags = null;
23          super.tearDown();
24      }
25  
26      //
27      //Simple save/get tests -- helps make sure there weren't
28      //setField typos.
29      //
30      public void testGetSetTagValue() throws DBException {
31          String val = "TEST";
32          nodeTags.setTagValue(val);
33          assertEquals(val, nodeTags.getTagValue());
34      }
35  
36      public void testGetSetNodeId() throws DBException {
37          Integer val = new Integer("33");
38          nodeTags.setNodeId(val);
39          assertEquals(val, nodeTags.getNodeId());
40      }
41  
42      public void testGetSetAddedBy() throws DBException  {
43          String val = "TEST";
44          nodeTags.setAddedBy(val);
45          assertEquals(val, nodeTags.getAddedBy());
46      }
47  
48      public void testGetSetAddedOn() throws DBException  {
49          Calendar cal = Calendar.getInstance(Locale.US);
50          cal.set(Calendar.SECOND, 0);
51          cal.set(Calendar.MILLISECOND, 0);
52          cal.set(Calendar.MINUTE, 0);
53          cal.set(Calendar.HOUR_OF_DAY, 0);
54          Date val = cal.getTime();
55          nodeTags.setAddedOn(val);
56          assertEquals(val, nodeTags.getAddedOn());
57      }
58  
59  }