View Javadoc

1   package org.kuali.mobility.feedback.service;
2   
3   import org.apache.log4j.Logger;
4   import org.junit.*;
5   import org.junit.runner.RunWith;
6   import org.kuali.mobility.feedback.entity.Feedback;
7   import org.springframework.beans.factory.annotation.Autowired;
8   import org.springframework.beans.factory.annotation.Qualifier;
9   import org.springframework.test.context.ContextConfiguration;
10  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
11  
12  import javax.persistence.EntityManager;
13  import javax.persistence.PersistenceContext;
14  
15  import static org.junit.Assert.assertTrue;
16  
17  /**
18   * @author Kuali Mobility Team (mobility.collab@kuali.org)
19   */
20  @RunWith(SpringJUnit4ClassRunner.class)
21  @ContextConfiguration(value = "classpath:TestSpringBeans.xml")
22  public class FeedbackServiceImplTest {
23  
24  	private static final Logger LOG = Logger.getLogger( FeedbackServiceImplTest.class );
25  
26  	@PersistenceContext
27  	private EntityManager entityManager;
28  
29  	@Autowired
30  	@Qualifier("feedbackService")
31  	private FeedbackService feedbackService;
32  	
33  	@BeforeClass
34  	public static void setUpBeforeClass() throws Exception {
35  	}
36  
37  	@AfterClass
38  	public static void tearDownAfterClass() throws Exception {
39  	}
40  
41  	@Before
42  	public void setUp() throws Exception {
43  	}
44  
45  	@After
46  	public void tearDown() throws Exception {
47  	}
48  
49  	@Test
50  	public void testSaveFeedback() {
51  		Feedback f1 = new Feedback();
52  		f1.setEmail("Test mail");
53  		feedbackService.saveFeedback(f1);
54  		LOG.debug("Feedback id :" + f1.getFeedbackId());
55  		assertTrue("Feedback save failed", f1.getFeedbackId() != null);			
56  	}
57  
58  	public FeedbackService getFeedbackService() {
59  		return feedbackService;
60  	}
61  
62  	public void setFeedbackService(FeedbackService feedbackService) {
63  		this.feedbackService = feedbackService;
64  	}
65  	
66  }