PageRenderTime 25ms CodeModel.GetById 19ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/src/test/java/com/google/ie/business/dao/impl/AuditDaoImplTest.java

http://thoughtsite.googlecode.com/
Java | 51 lines | 28 code | 10 blank | 13 comment | 2 complexity | 5d9b3b8754a686f7f4a16e48aac06763 MD5 | raw file
 1// Copyright 2009 Google Inc. All Rights Reserved.
 2/**
 3 * 
 4 */
 5package com.google.ie.business.dao.impl;
 6
 7import static org.junit.Assert.assertEquals;
 8
 9import com.google.appengine.api.datastore.DatastoreServiceFactory;
10import com.google.appengine.api.datastore.Query;
11import com.google.ie.business.domain.Audit;
12import com.google.ie.test.DatastoreTest;
13
14import org.junit.Test;
15import org.springframework.context.annotation.Scope;
16
17/**
18 * @author asirohi
19 * 
20 */
21@Scope
22public class AuditDaoImplTest extends DatastoreTest {
23
24    private AuditDaoImpl auditDao;
25
26    @Override
27    public void setUp() {
28        super.setUp();
29        if (null == auditDao) {
30            auditDao = new AuditDaoImpl();
31            auditDao.setPersistenceManagerFactory(pmf);
32
33        }
34    }
35
36    /**
37     * Test method for
38     * {@link com.google.ie.business.dao.impl.AuditDaoImpl#saveAudit(com.google.ie.business.domain.Audit)}
39     * .
40     */
41    @Test
42    public void saveAudit() {
43        Audit audit = new Audit();
44        auditDao.saveAudit(audit);
45
46        Query query = new Query(Audit.class.getSimpleName());
47        assertEquals(1, DatastoreServiceFactory.getDatastoreService().prepare(query)
48                        .countEntities());
49    }
50
51}