View Javadoc
1   /*
2    * Copyright 2010-2025 James Pether Sörling
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   *	$Id$
17   *  $HeadURL$
18   */
19  package com.hack23.cia.service.data.impl;
20  
21  import java.util.List;
22  
23  import org.junit.Test;
24  import org.springframework.beans.factory.annotation.Autowired;
25  import org.springframework.transaction.annotation.Transactional;
26  
27  import com.hack23.cia.model.internal.application.data.ministry.impl.ViewMinistryDecisionImpact;
28  import com.hack23.cia.model.internal.application.data.ministry.impl.ViewMinistryDecisionImpactEmbeddedId;
29  import com.hack23.cia.service.data.api.ViewMinistryDecisionImpactDAO;
30  
31  /**
32   * The Class ViewMinistryDecisionImpactDAOITest.
33   * 
34   * Integration test for ministry decision impact view entity mapping.
35   * 
36   * @author intelligence-operative
37   * @since v1.35 (Decision Intelligence)
38   */
39  @Transactional
40  public class ViewMinistryDecisionImpactDAOITest extends AbstractServiceDataFunctionalIntegrationTest {
41  
42  	/** The dao. */
43  	@Autowired
44  	private ViewMinistryDecisionImpactDAO dao;
45  
46  	/**
47  	 * Gets the id list test.
48  	 *
49  	 * @return the id list test
50  	 * @throws Exception
51  	 *             the exception
52  	 */
53  	@Test
54  	public void getIdListTest() throws Exception {
55  		final List<ViewMinistryDecisionImpactEmbeddedId> all = dao.getIdList();
56  		assertNotNull(all);
57  	}
58  
59  	/**
60  	 * Find all test.
61  	 *
62  	 * @throws Exception
63  	 *             the exception
64  	 */
65  	@Test
66  	public void findAllTest() throws Exception {
67  		final List<ViewMinistryDecisionImpact> all = dao.getAll();
68  		assertNotNull(all);
69  		
70  		// If data exists, validate entity mapping
71  		if (!all.isEmpty()) {
72  			final ViewMinistryDecisionImpact entity = all.get(0);
73  			assertNotNull(entity.getEmbeddedId());
74  			assertNotNull(entity.getEmbeddedId().getMinistryCode());
75  			assertNotNull(entity.getEmbeddedId().getCommittee());
76  			assertTrue(entity.getTotalProposals() >= 0);
77  		}
78  	}
79  }