1   /***
2    Copyright (C) 2005 The Java Community
3   
4    This program is free software; you can redistribute it and/or modify  it under
5    the terms of the GNU General Public License as published by  the Free Software
6    Foundation; either version 2 of the License, or  (at your option) any later
7    version.
8   
9    This program is distributed in the hope that it will be useful,  but WITHOUT
10   ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS
11   FOR A PARTICULAR PURPOSE. See the  GNU General Public License for more details.
12  
13   You should have received a copy of the GNU General Public License  along with
14   this program; if not, write to the Free Software  Foundation, Inc., 59 Temple
15   Place, Suite 330, Boston, MA 02111-1307 USA.
16   */
17  package org.bejug.javacareers.jobs.common;
18  
19  import java.util.ArrayList;
20  
21  import org.bejug.javacareers.common.constants.JavacareersConstants;
22  import org.bejug.javacareers.common.service.ItemService;
23  
24  /***
25   * Tests the ItemService.
26   * @author Bart Meyers (Last modified by $Author$)
27   * @version $Revision$ - $Date$
28   */
29  public class ItemServiceTests extends AbstractSpringContextDBUnitTests {
30  	
31  	/***
32  	 * itemService, injected through field-injection.
33  	 */
34  	protected ItemService itemService = null;
35  	
36  	
37  	/***
38       * the names of the tables need to be compaired.
39       */
40      private static final String[] TABLE_NAMES = {"Parameter", "Country", 
41      	"Region", "Address", "Contact", "Organisation", "Person", "User", "Offer",
42      	"JobOffer", "Offer_OfferType", "Offer_Profile"};
43  	
44      
45      /***
46       * {@inheritDoc}
47       */
48      public void onSetUpInTransaction() throws Exception {
49          init(TABLE_NAMES);
50      }
51      
52      
53  	/***
54  	 * some tests to check whether the injections went well.
55  	 */
56  	public void testInjections() {
57  		assertNotNull(itemService);
58  	} //testInjection
59  	
60  	
61  	/***
62  	 * some tests to check whether the itemService does it's job.
63  	 */
64  	public void testGetAllItems() {
65  		ArrayList items = (ArrayList) itemService.getItems(40);
66  		assertEquals(items.size(), 5);
67  		items = (ArrayList) itemService.getItems(JavacareersConstants.JOBOFFER);
68  		assertEquals(items.size(), 5);
69  	} //testGetAllItems
70  	
71  }
72  /***
73   * $Log$
74   * Revision 1.1  2005/08/23 09:32:04  bme_jcs
75   * introduction of ItemService-classes
76   *
77   */