01: /*
02: * User: Michael Rettig
03: * Date: Sep 9, 2002
04: * Time: 11:15:22 PM
05: */
06: package net.sourceforge.jaxor.example.tests;
07:
08: import net.sourceforge.jaxor.example.domain.ObjectFactory;
09: import net.sourceforge.jaxor.example.simple.*;
10:
11: import java.util.ArrayList;
12: import java.util.List;
13:
14: public class SelectAllOrderByTest extends MultiTableTestCase {
15:
16: protected List getRows() {
17: List all = new ArrayList();
18: all.add(new CricketerMetaRow());
19: all.add(new PlayerLookupMetaRow());
20: return all;
21: }
22:
23: public void testSelectAll() {
24: assertEquals(0, CricketerFinder.selectAllOrderByPlayerIdList()
25: .size());
26: int[] ids = new int[] { 2, 3, 5, 1, 4 };
27: for (int i = 0; i < ids.length; i++)
28: ObjectFactory.createCricketer(new Long(ids[i]));
29: commit();
30: CricketerList list = CricketerFinder
31: .selectAllOrderByPlayerIdList();
32: assertEquals(5, list.size());
33: int count = 1;
34: for (CricketerIterator iterator = list.iterator(); iterator
35: .hasNext();) {
36: CricketerEntity cricketerEntity = iterator.next();
37: assertEquals(new Long(count++), cricketerEntity
38: .getPlayerId());
39: }
40: }
41: }
|