diff --git a/impl/core/src/test/java/transaction/defaultstrategy/TransactionDefaultTest.java b/impl/core/src/test/java/transaction/defaultstrategy/TransactionDefaultTest.java new file mode 100644 index 0000000..e90fab0 --- /dev/null +++ b/impl/core/src/test/java/transaction/defaultstrategy/TransactionDefaultTest.java @@ -0,0 +1,103 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package transaction.defaultstrategy; + +import javax.inject.Inject; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import br.gov.frameworkdemoiselle.DemoiselleException; +import br.gov.frameworkdemoiselle.transaction.Transaction; +import br.gov.frameworkdemoiselle.transaction.TransactionContext; + +import test.Tests; + +@RunWith(Arquillian.class) +public class TransactionDefaultTest { + + @Inject + private TransactionContext context; + + private Transaction transaction; + + @Deployment + public static JavaArchive createDeployment() { + JavaArchive deployment = Tests.createDeployment(TransactionDefaultTest.class); + return deployment; + } + + @Before + public void setTransaction() { + transaction = context.getCurrentTransaction(); + } + + @Test(expected = DemoiselleException.class) + public void defaultTransactionBegin() { + transaction.begin(); + } + + @Test(expected = DemoiselleException.class) + public void defaultTransactionCommit() { + transaction.commit(); + } + + @Test(expected = DemoiselleException.class) + public void defaultTransactionIsActive() { + transaction.isActive(); + } + + @Test(expected = DemoiselleException.class) + public void defaultTransactionIsMarkedRollback() { + transaction.isMarkedRollback(); + } + + @Test(expected = DemoiselleException.class) + public void defaultTransactionRollback() { + transaction.rollback(); + } + + @Test(expected = DemoiselleException.class) + public void defaultTransactionSetRollbackOnly() { + transaction.setRollbackOnly(); + } + +} -- libgit2 0.21.2