Commit 355a095595d86b368cefd9c4201bb7c70b66f3fc

Authored by Ednara Oliveira
1 parent edf064df
Exists in master

add cabeçalho

impl/core/src/test/java/exception/CustomException.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package exception; 37 package exception;
2 38
3 import br.gov.frameworkdemoiselle.exception.ApplicationException; 39 import br.gov.frameworkdemoiselle.exception.ApplicationException;
4 40
5 -  
6 @ApplicationException 41 @ApplicationException
7 public class CustomException extends RuntimeException { 42 public class CustomException extends RuntimeException {
8 43
9 private static final long serialVersionUID = 1L; 44 private static final long serialVersionUID = 1L;
10 45
11 -}  
12 \ No newline at end of file 46 \ No newline at end of file
  47 +}
impl/core/src/test/java/exception/CustomExceptionHandler.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package exception; 37 package exception;
2 38
3 import br.gov.frameworkdemoiselle.exception.ExceptionHandler; 39 import br.gov.frameworkdemoiselle.exception.ExceptionHandler;
impl/core/src/test/java/exception/CustomExceptionTest.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package exception; 37 package exception;
2 38
3 import static junit.framework.Assert.assertEquals; 39 import static junit.framework.Assert.assertEquals;
@@ -14,16 +50,16 @@ import test.Tests; @@ -14,16 +50,16 @@ import test.Tests;
14 50
15 @RunWith(Arquillian.class) 51 @RunWith(Arquillian.class)
16 public class CustomExceptionTest { 52 public class CustomExceptionTest {
17 - 53 +
18 @Inject 54 @Inject
19 private CustomExceptionHandler exception; 55 private CustomExceptionHandler exception;
20 - 56 +
21 @Deployment 57 @Deployment
22 public static JavaArchive createDeployment() { 58 public static JavaArchive createDeployment() {
23 JavaArchive deployment = Tests.createDeployment(CustomExceptionTest.class); 59 JavaArchive deployment = Tests.createDeployment(CustomExceptionTest.class);
24 return deployment; 60 return deployment;
25 } 61 }
26 - 62 +
27 @Test 63 @Test
28 public void testCustomExceptionHandler() { 64 public void testCustomExceptionHandler() {
29 exception.throwExceptionWithMessage(); 65 exception.throwExceptionWithMessage();
impl/core/src/test/java/exception/ExceptionHandlerTwoParameter.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package exception; 37 package exception;
2 38
3 import java.awt.geom.IllegalPathStateException; 39 import java.awt.geom.IllegalPathStateException;
@@ -11,8 +47,8 @@ public class ExceptionHandlerTwoParameter { @@ -11,8 +47,8 @@ public class ExceptionHandlerTwoParameter {
11 public void throwIllegalPathException() { 47 public void throwIllegalPathException() {
12 throw new IllegalPathStateException(); 48 throw new IllegalPathStateException();
13 } 49 }
14 - 50 +
15 @ExceptionHandler 51 @ExceptionHandler
16 public void handler(IllegalPathStateException cause, IllegalStateException cause2) { 52 public void handler(IllegalPathStateException cause, IllegalStateException cause2) {
17 - } 53 + }
18 } 54 }
impl/core/src/test/java/exception/ExceptionInheritance.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package exception; 37 package exception;
2 38
3 import br.gov.frameworkdemoiselle.exception.ExceptionHandler; 39 import br.gov.frameworkdemoiselle.exception.ExceptionHandler;
@@ -7,13 +43,13 @@ import br.gov.frameworkdemoiselle.stereotype.Controller; @@ -7,13 +43,13 @@ import br.gov.frameworkdemoiselle.stereotype.Controller;
7 public class ExceptionInheritance { 43 public class ExceptionInheritance {
8 44
9 private boolean handlerSuperClass = false; 45 private boolean handlerSuperClass = false;
10 - 46 +
11 private boolean handlerClass = false; 47 private boolean handlerClass = false;
12 - 48 +
13 public boolean isHandlerSuperClass() { 49 public boolean isHandlerSuperClass() {
14 return handlerSuperClass; 50 return handlerSuperClass;
15 } 51 }
16 - 52 +
17 public boolean isHandlerClass() { 53 public boolean isHandlerClass() {
18 return handlerClass; 54 return handlerClass;
19 } 55 }
@@ -21,7 +57,7 @@ public class ExceptionInheritance { @@ -21,7 +57,7 @@ public class ExceptionInheritance {
21 public void throwNullPointerException() { 57 public void throwNullPointerException() {
22 throw new NullPointerException(); 58 throw new NullPointerException();
23 } 59 }
24 - 60 +
25 public void throwArithmeticException() { 61 public void throwArithmeticException() {
26 throw new ArithmeticException(); 62 throw new ArithmeticException();
27 } 63 }
@@ -30,10 +66,10 @@ public class ExceptionInheritance { @@ -30,10 +66,10 @@ public class ExceptionInheritance {
30 public void handle(ArithmeticException e) { 66 public void handle(ArithmeticException e) {
31 handlerClass = true; 67 handlerClass = true;
32 } 68 }
33 - 69 +
34 @ExceptionHandler 70 @ExceptionHandler
35 public void handle(RuntimeException e) { 71 public void handle(RuntimeException e) {
36 handlerSuperClass = true; 72 handlerSuperClass = true;
37 } 73 }
38 - 74 +
39 } 75 }
impl/core/src/test/java/exception/ExceptionInheritanceTest.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package exception; 37 package exception;
2 38
3 import static junit.framework.Assert.assertEquals; 39 import static junit.framework.Assert.assertEquals;
@@ -14,16 +50,16 @@ import test.Tests; @@ -14,16 +50,16 @@ import test.Tests;
14 50
15 @RunWith(Arquillian.class) 51 @RunWith(Arquillian.class)
16 public class ExceptionInheritanceTest { 52 public class ExceptionInheritanceTest {
17 - 53 +
18 @Inject 54 @Inject
19 private ExceptionInheritance exceptionInheritance; 55 private ExceptionInheritance exceptionInheritance;
20 - 56 +
21 @Deployment 57 @Deployment
22 public static JavaArchive createDeployment() { 58 public static JavaArchive createDeployment() {
23 JavaArchive deployment = Tests.createDeployment(ExceptionInheritanceTest.class); 59 JavaArchive deployment = Tests.createDeployment(ExceptionInheritanceTest.class);
24 return deployment; 60 return deployment;
25 } 61 }
26 - 62 +
27 @Test 63 @Test
28 public void testExceptionInheritanceSuperClass() { 64 public void testExceptionInheritanceSuperClass() {
29 exceptionInheritance.throwNullPointerException(); 65 exceptionInheritance.throwNullPointerException();
@@ -35,5 +71,5 @@ public class ExceptionInheritanceTest { @@ -35,5 +71,5 @@ public class ExceptionInheritanceTest {
35 exceptionInheritance.throwArithmeticException(); 71 exceptionInheritance.throwArithmeticException();
36 assertEquals(false, exceptionInheritance.isHandlerSuperClass()); 72 assertEquals(false, exceptionInheritance.isHandlerSuperClass());
37 assertEquals(true, exceptionInheritance.isHandlerClass()); 73 assertEquals(true, exceptionInheritance.isHandlerClass());
38 - } 74 + }
39 } 75 }
impl/core/src/test/java/exception/MultiException.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package exception; 37 package exception;
2 38
3 import br.gov.frameworkdemoiselle.exception.ExceptionHandler; 39 import br.gov.frameworkdemoiselle.exception.ExceptionHandler;
impl/core/src/test/java/exception/MultiExceptionTest.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package exception; 37 package exception;
2 38
3 import javax.inject.Inject; 39 import javax.inject.Inject;
@@ -20,7 +56,7 @@ public class MultiExceptionTest { @@ -20,7 +56,7 @@ public class MultiExceptionTest {
20 56
21 @Inject 57 @Inject
22 private MultiException multiException; 58 private MultiException multiException;
23 - 59 +
24 @Inject 60 @Inject
25 private ExceptionHandlerTwoParameter exceptionTwoParameter; 61 private ExceptionHandlerTwoParameter exceptionTwoParameter;
26 62
@@ -37,14 +73,14 @@ public class MultiExceptionTest { @@ -37,14 +73,14 @@ public class MultiExceptionTest {
37 assertEquals(true, multiException.isArithmeticExceptionHandler()); 73 assertEquals(true, multiException.isArithmeticExceptionHandler());
38 assertEquals(true, multiException.isArithmeticExceptionHandler()); 74 assertEquals(true, multiException.isArithmeticExceptionHandler());
39 } 75 }
40 - 76 +
41 @Test 77 @Test
42 public void testTwoExceptionOneMethod() { 78 public void testTwoExceptionOneMethod() {
43 multiException.throwTwoException(); 79 multiException.throwTwoException();
44 assertEquals(true, multiException.isNullPointerExceptionHandler()); 80 assertEquals(true, multiException.isNullPointerExceptionHandler());
45 assertEquals(false, multiException.isArithmeticExceptionHandler()); 81 assertEquals(false, multiException.isArithmeticExceptionHandler());
46 } 82 }
47 - 83 +
48 @Test 84 @Test
49 public void testExceptionHandlerWithTwoParameter() { 85 public void testExceptionHandlerWithTwoParameter() {
50 try { 86 try {
impl/core/src/test/java/exception/MultiStrategyExceptionHandler.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package exception; 37 package exception;
2 38
3 import br.gov.frameworkdemoiselle.exception.ExceptionHandler; 39 import br.gov.frameworkdemoiselle.exception.ExceptionHandler;
@@ -29,7 +65,7 @@ public class MultiStrategyExceptionHandler { @@ -29,7 +65,7 @@ public class MultiStrategyExceptionHandler {
29 } 65 }
30 txt.toString(); 66 txt.toString();
31 } 67 }
32 - 68 +
33 @SuppressWarnings("unused") 69 @SuppressWarnings("unused")
34 public void exceptionMultiStrategyHandlerAndTry() { 70 public void exceptionMultiStrategyHandlerAndTry() {
35 txt.toString(); 71 txt.toString();
@@ -38,7 +74,7 @@ public class MultiStrategyExceptionHandler { @@ -38,7 +74,7 @@ public class MultiStrategyExceptionHandler {
38 } catch (ArithmeticException e) { 74 } catch (ArithmeticException e) {
39 exceptionTryCacth = true; 75 exceptionTryCacth = true;
40 } 76 }
41 - } 77 + }
42 78
43 public void exceptionTwoHandler() { 79 public void exceptionTwoHandler() {
44 try { 80 try {
impl/core/src/test/java/exception/MultiStrategyExceptionHandlerTest.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package exception; 37 package exception;
2 38
3 import static junit.framework.Assert.assertEquals; 39 import static junit.framework.Assert.assertEquals;
@@ -30,25 +66,25 @@ public class MultiStrategyExceptionHandlerTest { @@ -30,25 +66,25 @@ public class MultiStrategyExceptionHandlerTest {
30 assertEquals(true, handlerTest.isExceptionTryCacth()); 66 assertEquals(true, handlerTest.isExceptionTryCacth());
31 assertEquals(true, handlerTest.isExceptionHandler()); 67 assertEquals(true, handlerTest.isExceptionHandler());
32 } 68 }
33 - 69 +
34 @Test 70 @Test
35 public void testExceptionMultiStrategyHandlerAndTry() { 71 public void testExceptionMultiStrategyHandlerAndTry() {
36 handlerTest.exceptionMultiStrategyHandlerAndTry(); 72 handlerTest.exceptionMultiStrategyHandlerAndTry();
37 assertEquals(false, handlerTest.isExceptionTryCacth()); 73 assertEquals(false, handlerTest.isExceptionTryCacth());
38 assertEquals(true, handlerTest.isExceptionHandler()); 74 assertEquals(true, handlerTest.isExceptionHandler());
39 - }  
40 - 75 + }
  76 +
41 @Test 77 @Test
42 public void testSameExceptionTwoStrategyHandler() { 78 public void testSameExceptionTwoStrategyHandler() {
43 handlerTest.exceptionTwoHandler(); 79 handlerTest.exceptionTwoHandler();
44 assertEquals(true, handlerTest.isExceptionTryCacth()); 80 assertEquals(true, handlerTest.isExceptionTryCacth());
45 assertEquals(false, handlerTest.isExceptionHandler()); 81 assertEquals(false, handlerTest.isExceptionHandler());
46 } 82 }
47 - 83 +
48 @Test 84 @Test
49 public void testExceptionOneStrategyHandler() { 85 public void testExceptionOneStrategyHandler() {
50 handlerTest.exceptionHandler(); 86 handlerTest.exceptionHandler();
51 assertEquals(false, handlerTest.isExceptionTryCacth()); 87 assertEquals(false, handlerTest.isExceptionTryCacth());
52 assertEquals(true, handlerTest.isExceptionHandler()); 88 assertEquals(true, handlerTest.isExceptionHandler());
53 - } 89 + }
54 } 90 }
impl/core/src/test/java/exception/OneException.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package exception; 37 package exception;
2 38
3 import java.util.NoSuchElementException; 39 import java.util.NoSuchElementException;
@@ -7,19 +43,19 @@ import br.gov.frameworkdemoiselle.stereotype.Controller; @@ -7,19 +43,19 @@ import br.gov.frameworkdemoiselle.stereotype.Controller;
7 43
8 @Controller 44 @Controller
9 public class OneException { 45 public class OneException {
10 - 46 +
11 private boolean exceptionHandler = false; 47 private boolean exceptionHandler = false;
12 - 48 +
13 private boolean exceptionHandlerIllegalArgument1 = false; 49 private boolean exceptionHandlerIllegalArgument1 = false;
14 50
15 private boolean exceptionHandlerIllegalArgument2 = false; 51 private boolean exceptionHandlerIllegalArgument2 = false;
16 52
17 - private boolean exceptionHandlerIllegalArgument3 = false; 53 + private boolean exceptionHandlerIllegalArgument3 = false;
18 54
19 public boolean isExceptionHandler() { 55 public boolean isExceptionHandler() {
20 return exceptionHandler; 56 return exceptionHandler;
21 } 57 }
22 - 58 +
23 public boolean isExceptionHandlerIllegalArgument1() { 59 public boolean isExceptionHandlerIllegalArgument1() {
24 return exceptionHandlerIllegalArgument1; 60 return exceptionHandlerIllegalArgument1;
25 } 61 }
@@ -30,8 +66,8 @@ public class OneException { @@ -30,8 +66,8 @@ public class OneException {
30 66
31 public boolean isExceptionHandlerIllegalArgument3() { 67 public boolean isExceptionHandlerIllegalArgument3() {
32 return exceptionHandlerIllegalArgument3; 68 return exceptionHandlerIllegalArgument3;
33 - }  
34 - 69 + }
  70 +
35 @SuppressWarnings("null") 71 @SuppressWarnings("null")
36 public void throwExceptionWithHandler() { 72 public void throwExceptionWithHandler() {
37 String txt = null; 73 String txt = null;
@@ -40,16 +76,16 @@ public class OneException { @@ -40,16 +76,16 @@ public class OneException {
40 76
41 @SuppressWarnings("unused") 77 @SuppressWarnings("unused")
42 public void throwExceptionWithoutHandler() { 78 public void throwExceptionWithoutHandler() {
43 - int result = 4/0; 79 + int result = 4 / 0;
44 } 80 }
45 - 81 +
46 public void throwIllegalArgumentException() { 82 public void throwIllegalArgumentException() {
47 throw new IllegalArgumentException(); 83 throw new IllegalArgumentException();
48 } 84 }
49 - 85 +
50 public void throwNoSuchElementException() { 86 public void throwNoSuchElementException() {
51 throw new NoSuchElementException(); 87 throw new NoSuchElementException();
52 - } 88 + }
53 89
54 @ExceptionHandler 90 @ExceptionHandler
55 public void handler(NullPointerException cause) { 91 public void handler(NullPointerException cause) {
@@ -60,19 +96,20 @@ public class OneException { @@ -60,19 +96,20 @@ public class OneException {
60 public void handler1(IllegalArgumentException cause) { 96 public void handler1(IllegalArgumentException cause) {
61 exceptionHandlerIllegalArgument1 = true; 97 exceptionHandlerIllegalArgument1 = true;
62 } 98 }
63 - 99 +
64 @ExceptionHandler 100 @ExceptionHandler
65 public void handler3(IllegalArgumentException cause) { 101 public void handler3(IllegalArgumentException cause) {
66 exceptionHandlerIllegalArgument3 = true; 102 exceptionHandlerIllegalArgument3 = true;
67 } 103 }
68 - 104 +
69 @ExceptionHandler 105 @ExceptionHandler
70 public void handler2(IllegalArgumentException cause) { 106 public void handler2(IllegalArgumentException cause) {
71 exceptionHandlerIllegalArgument2 = true; 107 exceptionHandlerIllegalArgument2 = true;
72 } 108 }
73 - 109 +
74 @ExceptionHandler 110 @ExceptionHandler
  111 + @SuppressWarnings("unused")
75 public void handlerWithError(NoSuchElementException cause) { 112 public void handlerWithError(NoSuchElementException cause) {
76 - int a = 2/0; 113 + int a = 2 / 0;
77 } 114 }
78 } 115 }
impl/core/src/test/java/exception/OneExceptionTest.java
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
1 package exception; 37 package exception;
2 38
3 import javax.inject.Inject; 39 import javax.inject.Inject;
@@ -40,15 +76,15 @@ public class OneExceptionTest { @@ -40,15 +76,15 @@ public class OneExceptionTest {
40 assertEquals(ArithmeticException.class, cause.getClass()); 76 assertEquals(ArithmeticException.class, cause.getClass());
41 } 77 }
42 } 78 }
43 - 79 +
44 @Test 80 @Test
45 public void testExceptionWithMultiHandler() { 81 public void testExceptionWithMultiHandler() {
46 oneException.throwIllegalArgumentException(); 82 oneException.throwIllegalArgumentException();
47 assertEquals(false, oneException.isExceptionHandlerIllegalArgument1()); 83 assertEquals(false, oneException.isExceptionHandlerIllegalArgument1());
48 assertEquals(true, oneException.isExceptionHandlerIllegalArgument2()); 84 assertEquals(true, oneException.isExceptionHandlerIllegalArgument2());
49 assertEquals(false, oneException.isExceptionHandlerIllegalArgument3()); 85 assertEquals(false, oneException.isExceptionHandlerIllegalArgument3());
50 - }  
51 - 86 + }
  87 +
52 @Test 88 @Test
53 public void testExceptionHandlerWithException() { 89 public void testExceptionHandlerWithException() {
54 try { 90 try {
@@ -56,7 +92,6 @@ public class OneExceptionTest { @@ -56,7 +92,6 @@ public class OneExceptionTest {
56 } catch (Exception e) { 92 } catch (Exception e) {
57 assertEquals(ArithmeticException.class, e.getClass()); 93 assertEquals(ArithmeticException.class, e.getClass());
58 } 94 }
59 -  
60 -  
61 - } 95 +
  96 + }
62 } 97 }