View Javadoc
1   package org.melati.poem.test;
2   
3   import org.melati.poem.Table;
4   import org.melati.poem.UserTable;
5   
6   /**
7    * A test of the example database which exercises every datatype and table type. 
8    * 
9    * @author timp
10   */
11  public class EverythingDatabaseTest extends EverythingTestCase {
12  
13    public EverythingDatabaseTest(String arg0) {
14      super(arg0);
15    }
16  
17    protected void setUp() throws Exception {
18      super.setUp();
19    }
20  
21    /**
22     * Test method for 'org.melati.poem.test.generated.EverythingDatabaseBase.getUserTable()'
23     * Test method for 'org.melati.poem.Database.getTable(String)'
24     */
25    @SuppressWarnings("unchecked")
26    public void testGetUserTable() {
27        UserTable<org.melati.poem.User> ut1 = getDb().getUserTable();
28        UserTable<User> ut2 = (UserTable<User>)getDb().getTable("user");
29        assertEquals(ut1, ut2);
30    }
31  
32    /**
33     * Test method for 'org.melati.poem.Database.getDisplayTables()'
34     */
35    public void testGetDisplayTables() {
36      final String expected = 
37      "BinaryField (from the data structure definition)" +
38      "StringField (from the data structure definition)" + 
39      "PasswordField (from the data structure definition)" + 
40      "BooleanField (from the data structure definition)" + 
41      "DateField (from the data structure definition)" + 
42      "DoubleField (from the data structure definition)" + 
43      "IntegerField (from the data structure definition)" + 
44      "LongField (from the data structure definition)" + 
45      "BigdecimalField (from the data structure definition)" + 
46      "TimestampField (from the data structure definition)" + 
47      "EverythingNormal (from the data structure definition)" + 
48      "ENExtended (from the data structure definition)" + 
49      "EAExtended (from the data structure definition)" + 
50      "Protected (from the data structure definition)" +
51      "Dynamic (from the data structure definition)" +
52      "User (from the data structure definition)" + 
53      "Account (from the data structure definition)" + 
54      "group (from the data structure definition)" + 
55      "capability (from the data structure definition)" + 
56      "groupMembership (from the data structure definition)" + 
57      "groupCapability (from the data structure definition)" + 
58      "tableInfo (from the data structure definition)" + 
59      "columnInfo (from the data structure definition)" + 
60      "tableCategory (from the data structure definition)" +
61      "setting (from the data structure definition)";
62  
63      String outcome = "";
64      for (Table<?> t : getDb().getDisplayTables()) { 
65        outcome += t.toString();      
66      }
67      //System.err.println(expected);
68      //System.err.println(result);
69      assertEquals(expected, outcome);
70    }
71  
72  }