01: /**
02: * Copyright (C) 2006 NetMind Consulting Bt.
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 3 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */package hu.netmind.persistence;
18:
19: import java.util.List;
20:
21: /**
22: * These tests are need to run on an empty database.
23: * @author Brautigam Robert
24: * @version Revision: $Revision$
25: */
26: public class VanillaTests extends AbstractPersistenceTest {
27: public VanillaTests(String name) throws Exception {
28: super (name);
29: }
30:
31: /**
32: * Setup also clears database.
33: */
34: protected void setUp() throws Exception {
35: super .setUp();
36: dropTables("ids");
37: dropTables("classes");
38: dropTables("tablemap");
39: super .tearDown();
40: super .setUp();
41: }
42:
43: public void testSelectFromNonExistentTable() throws Exception {
44: // Select
45: List result = store.find("find book");
46: assertEquals(0, result.size());
47:
48: // Again
49: result = store.find("find book where book.title='No worries.'");
50: assertEquals(0, result.size());
51: }
52:
53: public void testReferToNonExistentTable() throws Exception {
54: // Create book but not author
55: Book b = new Book("Book of no Author", "1");
56: store.save(b);
57:
58: // Select
59: List result = store
60: .find("find book where book.mainauthor.firstName='Bob'");
61: assertEquals(0, result.size());
62: }
63:
64: }
|