From 355a095595d86b368cefd9c4201bb7c70b66f3fc Mon Sep 17 00:00:00 2001 From: Ednara Oliveira Date: Tue, 23 Apr 2013 18:36:59 -0300 Subject: [PATCH] add cabeçalho --- impl/core/src/test/java/exception/CustomException.java | 39 +++++++++++++++++++++++++++++++++++++-- impl/core/src/test/java/exception/CustomExceptionHandler.java | 36 ++++++++++++++++++++++++++++++++++++ impl/core/src/test/java/exception/CustomExceptionTest.java | 42 +++++++++++++++++++++++++++++++++++++++--- impl/core/src/test/java/exception/ExceptionHandlerTwoParameter.java | 40 ++++++++++++++++++++++++++++++++++++++-- impl/core/src/test/java/exception/ExceptionInheritance.java | 48 ++++++++++++++++++++++++++++++++++++++++++------ impl/core/src/test/java/exception/ExceptionInheritanceTest.java | 44 ++++++++++++++++++++++++++++++++++++++++---- impl/core/src/test/java/exception/MultiException.java | 36 ++++++++++++++++++++++++++++++++++++ impl/core/src/test/java/exception/MultiExceptionTest.java | 42 +++++++++++++++++++++++++++++++++++++++--- impl/core/src/test/java/exception/MultiStrategyExceptionHandler.java | 40 ++++++++++++++++++++++++++++++++++++++-- impl/core/src/test/java/exception/MultiStrategyExceptionHandlerTest.java | 46 +++++++++++++++++++++++++++++++++++++++++----- impl/core/src/test/java/exception/OneException.java | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++-------------- impl/core/src/test/java/exception/OneExceptionTest.java | 47 +++++++++++++++++++++++++++++++++++++++++------ 12 files changed, 478 insertions(+), 47 deletions(-) diff --git a/impl/core/src/test/java/exception/CustomException.java b/impl/core/src/test/java/exception/CustomException.java index eefc046..8ba8ee4 100644 --- a/impl/core/src/test/java/exception/CustomException.java +++ b/impl/core/src/test/java/exception/CustomException.java @@ -1,11 +1,46 @@ +/* + * 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 exception; import br.gov.frameworkdemoiselle.exception.ApplicationException; - @ApplicationException public class CustomException extends RuntimeException { private static final long serialVersionUID = 1L; -} \ No newline at end of file +} diff --git a/impl/core/src/test/java/exception/CustomExceptionHandler.java b/impl/core/src/test/java/exception/CustomExceptionHandler.java index f6dfc18..1a775b2 100644 --- a/impl/core/src/test/java/exception/CustomExceptionHandler.java +++ b/impl/core/src/test/java/exception/CustomExceptionHandler.java @@ -1,3 +1,39 @@ +/* + * 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 exception; import br.gov.frameworkdemoiselle.exception.ExceptionHandler; diff --git a/impl/core/src/test/java/exception/CustomExceptionTest.java b/impl/core/src/test/java/exception/CustomExceptionTest.java index e9dc73d..30057dc 100644 --- a/impl/core/src/test/java/exception/CustomExceptionTest.java +++ b/impl/core/src/test/java/exception/CustomExceptionTest.java @@ -1,3 +1,39 @@ +/* + * 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 exception; import static junit.framework.Assert.assertEquals; @@ -14,16 +50,16 @@ import test.Tests; @RunWith(Arquillian.class) public class CustomExceptionTest { - + @Inject private CustomExceptionHandler exception; - + @Deployment public static JavaArchive createDeployment() { JavaArchive deployment = Tests.createDeployment(CustomExceptionTest.class); return deployment; } - + @Test public void testCustomExceptionHandler() { exception.throwExceptionWithMessage(); diff --git a/impl/core/src/test/java/exception/ExceptionHandlerTwoParameter.java b/impl/core/src/test/java/exception/ExceptionHandlerTwoParameter.java index ae51937..d94d97f 100644 --- a/impl/core/src/test/java/exception/ExceptionHandlerTwoParameter.java +++ b/impl/core/src/test/java/exception/ExceptionHandlerTwoParameter.java @@ -1,3 +1,39 @@ +/* + * 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 exception; import java.awt.geom.IllegalPathStateException; @@ -11,8 +47,8 @@ public class ExceptionHandlerTwoParameter { public void throwIllegalPathException() { throw new IllegalPathStateException(); } - + @ExceptionHandler public void handler(IllegalPathStateException cause, IllegalStateException cause2) { - } + } } diff --git a/impl/core/src/test/java/exception/ExceptionInheritance.java b/impl/core/src/test/java/exception/ExceptionInheritance.java index 175be23..9a5b79b 100644 --- a/impl/core/src/test/java/exception/ExceptionInheritance.java +++ b/impl/core/src/test/java/exception/ExceptionInheritance.java @@ -1,3 +1,39 @@ +/* + * 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 exception; import br.gov.frameworkdemoiselle.exception.ExceptionHandler; @@ -7,13 +43,13 @@ import br.gov.frameworkdemoiselle.stereotype.Controller; public class ExceptionInheritance { private boolean handlerSuperClass = false; - + private boolean handlerClass = false; - + public boolean isHandlerSuperClass() { return handlerSuperClass; } - + public boolean isHandlerClass() { return handlerClass; } @@ -21,7 +57,7 @@ public class ExceptionInheritance { public void throwNullPointerException() { throw new NullPointerException(); } - + public void throwArithmeticException() { throw new ArithmeticException(); } @@ -30,10 +66,10 @@ public class ExceptionInheritance { public void handle(ArithmeticException e) { handlerClass = true; } - + @ExceptionHandler public void handle(RuntimeException e) { handlerSuperClass = true; } - + } diff --git a/impl/core/src/test/java/exception/ExceptionInheritanceTest.java b/impl/core/src/test/java/exception/ExceptionInheritanceTest.java index 1a91834..d3ceeb0 100644 --- a/impl/core/src/test/java/exception/ExceptionInheritanceTest.java +++ b/impl/core/src/test/java/exception/ExceptionInheritanceTest.java @@ -1,3 +1,39 @@ +/* + * 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 exception; import static junit.framework.Assert.assertEquals; @@ -14,16 +50,16 @@ import test.Tests; @RunWith(Arquillian.class) public class ExceptionInheritanceTest { - + @Inject private ExceptionInheritance exceptionInheritance; - + @Deployment public static JavaArchive createDeployment() { JavaArchive deployment = Tests.createDeployment(ExceptionInheritanceTest.class); return deployment; } - + @Test public void testExceptionInheritanceSuperClass() { exceptionInheritance.throwNullPointerException(); @@ -35,5 +71,5 @@ public class ExceptionInheritanceTest { exceptionInheritance.throwArithmeticException(); assertEquals(false, exceptionInheritance.isHandlerSuperClass()); assertEquals(true, exceptionInheritance.isHandlerClass()); - } + } } diff --git a/impl/core/src/test/java/exception/MultiException.java b/impl/core/src/test/java/exception/MultiException.java index 5876fb5..a4b87f8 100644 --- a/impl/core/src/test/java/exception/MultiException.java +++ b/impl/core/src/test/java/exception/MultiException.java @@ -1,3 +1,39 @@ +/* + * 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 exception; import br.gov.frameworkdemoiselle.exception.ExceptionHandler; diff --git a/impl/core/src/test/java/exception/MultiExceptionTest.java b/impl/core/src/test/java/exception/MultiExceptionTest.java index 7f801ce..9e95020 100644 --- a/impl/core/src/test/java/exception/MultiExceptionTest.java +++ b/impl/core/src/test/java/exception/MultiExceptionTest.java @@ -1,3 +1,39 @@ +/* + * 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 exception; import javax.inject.Inject; @@ -20,7 +56,7 @@ public class MultiExceptionTest { @Inject private MultiException multiException; - + @Inject private ExceptionHandlerTwoParameter exceptionTwoParameter; @@ -37,14 +73,14 @@ public class MultiExceptionTest { assertEquals(true, multiException.isArithmeticExceptionHandler()); assertEquals(true, multiException.isArithmeticExceptionHandler()); } - + @Test public void testTwoExceptionOneMethod() { multiException.throwTwoException(); assertEquals(true, multiException.isNullPointerExceptionHandler()); assertEquals(false, multiException.isArithmeticExceptionHandler()); } - + @Test public void testExceptionHandlerWithTwoParameter() { try { diff --git a/impl/core/src/test/java/exception/MultiStrategyExceptionHandler.java b/impl/core/src/test/java/exception/MultiStrategyExceptionHandler.java index 3b652c5..3200a6d 100644 --- a/impl/core/src/test/java/exception/MultiStrategyExceptionHandler.java +++ b/impl/core/src/test/java/exception/MultiStrategyExceptionHandler.java @@ -1,3 +1,39 @@ +/* + * 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 exception; import br.gov.frameworkdemoiselle.exception.ExceptionHandler; @@ -29,7 +65,7 @@ public class MultiStrategyExceptionHandler { } txt.toString(); } - + @SuppressWarnings("unused") public void exceptionMultiStrategyHandlerAndTry() { txt.toString(); @@ -38,7 +74,7 @@ public class MultiStrategyExceptionHandler { } catch (ArithmeticException e) { exceptionTryCacth = true; } - } + } public void exceptionTwoHandler() { try { diff --git a/impl/core/src/test/java/exception/MultiStrategyExceptionHandlerTest.java b/impl/core/src/test/java/exception/MultiStrategyExceptionHandlerTest.java index d4df0ca..ec2f2e9 100644 --- a/impl/core/src/test/java/exception/MultiStrategyExceptionHandlerTest.java +++ b/impl/core/src/test/java/exception/MultiStrategyExceptionHandlerTest.java @@ -1,3 +1,39 @@ +/* + * 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 exception; import static junit.framework.Assert.assertEquals; @@ -30,25 +66,25 @@ public class MultiStrategyExceptionHandlerTest { assertEquals(true, handlerTest.isExceptionTryCacth()); assertEquals(true, handlerTest.isExceptionHandler()); } - + @Test public void testExceptionMultiStrategyHandlerAndTry() { handlerTest.exceptionMultiStrategyHandlerAndTry(); assertEquals(false, handlerTest.isExceptionTryCacth()); assertEquals(true, handlerTest.isExceptionHandler()); - } - + } + @Test public void testSameExceptionTwoStrategyHandler() { handlerTest.exceptionTwoHandler(); assertEquals(true, handlerTest.isExceptionTryCacth()); assertEquals(false, handlerTest.isExceptionHandler()); } - + @Test public void testExceptionOneStrategyHandler() { handlerTest.exceptionHandler(); assertEquals(false, handlerTest.isExceptionTryCacth()); assertEquals(true, handlerTest.isExceptionHandler()); - } + } } diff --git a/impl/core/src/test/java/exception/OneException.java b/impl/core/src/test/java/exception/OneException.java index 8dd6f6b..d8e7527 100644 --- a/impl/core/src/test/java/exception/OneException.java +++ b/impl/core/src/test/java/exception/OneException.java @@ -1,3 +1,39 @@ +/* + * 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 exception; import java.util.NoSuchElementException; @@ -7,19 +43,19 @@ import br.gov.frameworkdemoiselle.stereotype.Controller; @Controller public class OneException { - + private boolean exceptionHandler = false; - + private boolean exceptionHandlerIllegalArgument1 = false; private boolean exceptionHandlerIllegalArgument2 = false; - private boolean exceptionHandlerIllegalArgument3 = false; + private boolean exceptionHandlerIllegalArgument3 = false; public boolean isExceptionHandler() { return exceptionHandler; } - + public boolean isExceptionHandlerIllegalArgument1() { return exceptionHandlerIllegalArgument1; } @@ -30,8 +66,8 @@ public class OneException { public boolean isExceptionHandlerIllegalArgument3() { return exceptionHandlerIllegalArgument3; - } - + } + @SuppressWarnings("null") public void throwExceptionWithHandler() { String txt = null; @@ -40,16 +76,16 @@ public class OneException { @SuppressWarnings("unused") public void throwExceptionWithoutHandler() { - int result = 4/0; + int result = 4 / 0; } - + public void throwIllegalArgumentException() { throw new IllegalArgumentException(); } - + public void throwNoSuchElementException() { throw new NoSuchElementException(); - } + } @ExceptionHandler public void handler(NullPointerException cause) { @@ -60,19 +96,20 @@ public class OneException { public void handler1(IllegalArgumentException cause) { exceptionHandlerIllegalArgument1 = true; } - + @ExceptionHandler public void handler3(IllegalArgumentException cause) { exceptionHandlerIllegalArgument3 = true; } - + @ExceptionHandler public void handler2(IllegalArgumentException cause) { exceptionHandlerIllegalArgument2 = true; } - + @ExceptionHandler + @SuppressWarnings("unused") public void handlerWithError(NoSuchElementException cause) { - int a = 2/0; + int a = 2 / 0; } } diff --git a/impl/core/src/test/java/exception/OneExceptionTest.java b/impl/core/src/test/java/exception/OneExceptionTest.java index 47ced3b..150c80d 100644 --- a/impl/core/src/test/java/exception/OneExceptionTest.java +++ b/impl/core/src/test/java/exception/OneExceptionTest.java @@ -1,3 +1,39 @@ +/* + * 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 exception; import javax.inject.Inject; @@ -40,15 +76,15 @@ public class OneExceptionTest { assertEquals(ArithmeticException.class, cause.getClass()); } } - + @Test public void testExceptionWithMultiHandler() { oneException.throwIllegalArgumentException(); assertEquals(false, oneException.isExceptionHandlerIllegalArgument1()); assertEquals(true, oneException.isExceptionHandlerIllegalArgument2()); assertEquals(false, oneException.isExceptionHandlerIllegalArgument3()); - } - + } + @Test public void testExceptionHandlerWithException() { try { @@ -56,7 +92,6 @@ public class OneExceptionTest { } catch (Exception e) { assertEquals(ArithmeticException.class, e.getClass()); } - - - } + + } } -- libgit2 0.21.2