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 37 package exception;
2 38  
3 39 import br.gov.frameworkdemoiselle.exception.ApplicationException;
4 40  
5   -
6 41 @ApplicationException
7 42 public class CustomException extends RuntimeException {
8 43  
9 44 private static final long serialVersionUID = 1L;
10 45  
11   -}
12 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 37 package exception;
2 38  
3 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 37 package exception;
2 38  
3 39 import static junit.framework.Assert.assertEquals;
... ... @@ -14,16 +50,16 @@ import test.Tests;
14 50  
15 51 @RunWith(Arquillian.class)
16 52 public class CustomExceptionTest {
17   -
  53 +
18 54 @Inject
19 55 private CustomExceptionHandler exception;
20   -
  56 +
21 57 @Deployment
22 58 public static JavaArchive createDeployment() {
23 59 JavaArchive deployment = Tests.createDeployment(CustomExceptionTest.class);
24 60 return deployment;
25 61 }
26   -
  62 +
27 63 @Test
28 64 public void testCustomExceptionHandler() {
29 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 37 package exception;
2 38  
3 39 import java.awt.geom.IllegalPathStateException;
... ... @@ -11,8 +47,8 @@ public class ExceptionHandlerTwoParameter {
11 47 public void throwIllegalPathException() {
12 48 throw new IllegalPathStateException();
13 49 }
14   -
  50 +
15 51 @ExceptionHandler
16 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 37 package exception;
2 38  
3 39 import br.gov.frameworkdemoiselle.exception.ExceptionHandler;
... ... @@ -7,13 +43,13 @@ import br.gov.frameworkdemoiselle.stereotype.Controller;
7 43 public class ExceptionInheritance {
8 44  
9 45 private boolean handlerSuperClass = false;
10   -
  46 +
11 47 private boolean handlerClass = false;
12   -
  48 +
13 49 public boolean isHandlerSuperClass() {
14 50 return handlerSuperClass;
15 51 }
16   -
  52 +
17 53 public boolean isHandlerClass() {
18 54 return handlerClass;
19 55 }
... ... @@ -21,7 +57,7 @@ public class ExceptionInheritance {
21 57 public void throwNullPointerException() {
22 58 throw new NullPointerException();
23 59 }
24   -
  60 +
25 61 public void throwArithmeticException() {
26 62 throw new ArithmeticException();
27 63 }
... ... @@ -30,10 +66,10 @@ public class ExceptionInheritance {
30 66 public void handle(ArithmeticException e) {
31 67 handlerClass = true;
32 68 }
33   -
  69 +
34 70 @ExceptionHandler
35 71 public void handle(RuntimeException e) {
36 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 37 package exception;
2 38  
3 39 import static junit.framework.Assert.assertEquals;
... ... @@ -14,16 +50,16 @@ import test.Tests;
14 50  
15 51 @RunWith(Arquillian.class)
16 52 public class ExceptionInheritanceTest {
17   -
  53 +
18 54 @Inject
19 55 private ExceptionInheritance exceptionInheritance;
20   -
  56 +
21 57 @Deployment
22 58 public static JavaArchive createDeployment() {
23 59 JavaArchive deployment = Tests.createDeployment(ExceptionInheritanceTest.class);
24 60 return deployment;
25 61 }
26   -
  62 +
27 63 @Test
28 64 public void testExceptionInheritanceSuperClass() {
29 65 exceptionInheritance.throwNullPointerException();
... ... @@ -35,5 +71,5 @@ public class ExceptionInheritanceTest {
35 71 exceptionInheritance.throwArithmeticException();
36 72 assertEquals(false, exceptionInheritance.isHandlerSuperClass());
37 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 37 package exception;
2 38  
3 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 37 package exception;
2 38  
3 39 import javax.inject.Inject;
... ... @@ -20,7 +56,7 @@ public class MultiExceptionTest {
20 56  
21 57 @Inject
22 58 private MultiException multiException;
23   -
  59 +
24 60 @Inject
25 61 private ExceptionHandlerTwoParameter exceptionTwoParameter;
26 62  
... ... @@ -37,14 +73,14 @@ public class MultiExceptionTest {
37 73 assertEquals(true, multiException.isArithmeticExceptionHandler());
38 74 assertEquals(true, multiException.isArithmeticExceptionHandler());
39 75 }
40   -
  76 +
41 77 @Test
42 78 public void testTwoExceptionOneMethod() {
43 79 multiException.throwTwoException();
44 80 assertEquals(true, multiException.isNullPointerExceptionHandler());
45 81 assertEquals(false, multiException.isArithmeticExceptionHandler());
46 82 }
47   -
  83 +
48 84 @Test
49 85 public void testExceptionHandlerWithTwoParameter() {
50 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 37 package exception;
2 38  
3 39 import br.gov.frameworkdemoiselle.exception.ExceptionHandler;
... ... @@ -29,7 +65,7 @@ public class MultiStrategyExceptionHandler {
29 65 }
30 66 txt.toString();
31 67 }
32   -
  68 +
33 69 @SuppressWarnings("unused")
34 70 public void exceptionMultiStrategyHandlerAndTry() {
35 71 txt.toString();
... ... @@ -38,7 +74,7 @@ public class MultiStrategyExceptionHandler {
38 74 } catch (ArithmeticException e) {
39 75 exceptionTryCacth = true;
40 76 }
41   - }
  77 + }
42 78  
43 79 public void exceptionTwoHandler() {
44 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 37 package exception;
2 38  
3 39 import static junit.framework.Assert.assertEquals;
... ... @@ -30,25 +66,25 @@ public class MultiStrategyExceptionHandlerTest {
30 66 assertEquals(true, handlerTest.isExceptionTryCacth());
31 67 assertEquals(true, handlerTest.isExceptionHandler());
32 68 }
33   -
  69 +
34 70 @Test
35 71 public void testExceptionMultiStrategyHandlerAndTry() {
36 72 handlerTest.exceptionMultiStrategyHandlerAndTry();
37 73 assertEquals(false, handlerTest.isExceptionTryCacth());
38 74 assertEquals(true, handlerTest.isExceptionHandler());
39   - }
40   -
  75 + }
  76 +
41 77 @Test
42 78 public void testSameExceptionTwoStrategyHandler() {
43 79 handlerTest.exceptionTwoHandler();
44 80 assertEquals(true, handlerTest.isExceptionTryCacth());
45 81 assertEquals(false, handlerTest.isExceptionHandler());
46 82 }
47   -
  83 +
48 84 @Test
49 85 public void testExceptionOneStrategyHandler() {
50 86 handlerTest.exceptionHandler();
51 87 assertEquals(false, handlerTest.isExceptionTryCacth());
52 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 37 package exception;
2 38  
3 39 import java.util.NoSuchElementException;
... ... @@ -7,19 +43,19 @@ import br.gov.frameworkdemoiselle.stereotype.Controller;
7 43  
8 44 @Controller
9 45 public class OneException {
10   -
  46 +
11 47 private boolean exceptionHandler = false;
12   -
  48 +
13 49 private boolean exceptionHandlerIllegalArgument1 = false;
14 50  
15 51 private boolean exceptionHandlerIllegalArgument2 = false;
16 52  
17   - private boolean exceptionHandlerIllegalArgument3 = false;
  53 + private boolean exceptionHandlerIllegalArgument3 = false;
18 54  
19 55 public boolean isExceptionHandler() {
20 56 return exceptionHandler;
21 57 }
22   -
  58 +
23 59 public boolean isExceptionHandlerIllegalArgument1() {
24 60 return exceptionHandlerIllegalArgument1;
25 61 }
... ... @@ -30,8 +66,8 @@ public class OneException {
30 66  
31 67 public boolean isExceptionHandlerIllegalArgument3() {
32 68 return exceptionHandlerIllegalArgument3;
33   - }
34   -
  69 + }
  70 +
35 71 @SuppressWarnings("null")
36 72 public void throwExceptionWithHandler() {
37 73 String txt = null;
... ... @@ -40,16 +76,16 @@ public class OneException {
40 76  
41 77 @SuppressWarnings("unused")
42 78 public void throwExceptionWithoutHandler() {
43   - int result = 4/0;
  79 + int result = 4 / 0;
44 80 }
45   -
  81 +
46 82 public void throwIllegalArgumentException() {
47 83 throw new IllegalArgumentException();
48 84 }
49   -
  85 +
50 86 public void throwNoSuchElementException() {
51 87 throw new NoSuchElementException();
52   - }
  88 + }
53 89  
54 90 @ExceptionHandler
55 91 public void handler(NullPointerException cause) {
... ... @@ -60,19 +96,20 @@ public class OneException {
60 96 public void handler1(IllegalArgumentException cause) {
61 97 exceptionHandlerIllegalArgument1 = true;
62 98 }
63   -
  99 +
64 100 @ExceptionHandler
65 101 public void handler3(IllegalArgumentException cause) {
66 102 exceptionHandlerIllegalArgument3 = true;
67 103 }
68   -
  104 +
69 105 @ExceptionHandler
70 106 public void handler2(IllegalArgumentException cause) {
71 107 exceptionHandlerIllegalArgument2 = true;
72 108 }
73   -
  109 +
74 110 @ExceptionHandler
  111 + @SuppressWarnings("unused")
75 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 37 package exception;
2 38  
3 39 import javax.inject.Inject;
... ... @@ -40,15 +76,15 @@ public class OneExceptionTest {
40 76 assertEquals(ArithmeticException.class, cause.getClass());
41 77 }
42 78 }
43   -
  79 +
44 80 @Test
45 81 public void testExceptionWithMultiHandler() {
46 82 oneException.throwIllegalArgumentException();
47 83 assertEquals(false, oneException.isExceptionHandlerIllegalArgument1());
48 84 assertEquals(true, oneException.isExceptionHandlerIllegalArgument2());
49 85 assertEquals(false, oneException.isExceptionHandlerIllegalArgument3());
50   - }
51   -
  86 + }
  87 +
52 88 @Test
53 89 public void testExceptionHandlerWithException() {
54 90 try {
... ... @@ -56,7 +92,6 @@ public class OneExceptionTest {
56 92 } catch (Exception e) {
57 93 assertEquals(ArithmeticException.class, e.getClass());
58 94 }
59   -
60   -
61   - }
  95 +
  96 + }
62 97 }
... ...