/**
* =========================================================================
* __ ____ ____ __ ____ ___ __ __ ____ ____ ____
* || || \\ || (( \ || \\ // \\ ||\ || || \\ || || \\
* || ||_// ||== \\ ||_// (( )) ||\\|| || )) ||== ||_//
* |__|| || \\ ||___ \_)) || \\_// || \|| ||_// ||___ || \\
* =========================================================================
*
* Copyright 2012 Brad Peabody
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =========================================================================
*/
package org.jresponder;
import static org.junit.Assert.assertEquals;
import javax.annotation.Resource;
import org.jresponder.dao.MainDao;
import org.jresponder.domain.Subscriber;
import org.jresponder.domain.SubscriberStatus;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author bradpeabody
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration( {
"common-logging.xml",
"common-database.xml",
"MainDaoTestContext.xml"
})
public class MainDaoTest {
@Resource(name="jrMainDao")
private MainDao mainDao;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
}
@Test
public void testGetSubscriberByEmail() {
Subscriber mySubscriber = new Subscriber();
mySubscriber.setEmail("test@example.com");
mySubscriber.setSubscriberStatus(SubscriberStatus.OK);
mainDao.persist(mySubscriber);
assertEquals(mySubscriber.getId(), mainDao.getSubscriberByEmail("test@example.com").getId());
}
@Test
public void test1() {
System.out.println(mainDao.getSubscriberByEmail("test@example.com"));
}
}