Commit 2808792ff44e942ab3f22453d5bbddd72994e451
1 parent
d7ed5885
Exists in
master
Removidos os testes de Class Cast, pois não estavam testando o Framework
de fato
Showing
4 changed files
with
2 additions
and
109 deletions
Show diff stats
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/AbstractClassCastFieldConfig.java
| @@ -1,46 +0,0 @@ | @@ -1,46 +0,0 @@ | ||
| 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 | - */ | ||
| 37 | -package br.gov.frameworkdemoiselle.configuration.field.clazz; | ||
| 38 | - | ||
| 39 | -public abstract class AbstractClassCastFieldConfig { | ||
| 40 | - | ||
| 41 | - private Class<MyClass> forcingClassCastException; | ||
| 42 | - | ||
| 43 | - public Class<MyClass> getForcingClassCastException() { | ||
| 44 | - return forcingClassCastException; | ||
| 45 | - } | ||
| 46 | -} |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/ConfigurationClassFieldTest.java
| @@ -62,9 +62,6 @@ public class ConfigurationClassFieldTest extends AbstractConfigurationTest { | @@ -62,9 +62,6 @@ public class ConfigurationClassFieldTest extends AbstractConfigurationTest { | ||
| 62 | @Inject | 62 | @Inject |
| 63 | private PropertiesClassNotFoundFieldConfig propertiesNotFoundConfig; | 63 | private PropertiesClassNotFoundFieldConfig propertiesNotFoundConfig; |
| 64 | 64 | ||
| 65 | - @Inject | ||
| 66 | - private PropertiesClassCastFieldConfig propertiesCastConfig; | ||
| 67 | - | ||
| 68 | @Deployment | 65 | @Deployment |
| 69 | public static JavaArchive createDeployment() { | 66 | public static JavaArchive createDeployment() { |
| 70 | JavaArchive deployment = createConfigurationDeployment(); | 67 | JavaArchive deployment = createConfigurationDeployment(); |
| @@ -81,16 +78,12 @@ public class ConfigurationClassFieldTest extends AbstractConfigurationTest { | @@ -81,16 +78,12 @@ public class ConfigurationClassFieldTest extends AbstractConfigurationTest { | ||
| 81 | 78 | ||
| 82 | @Test | 79 | @Test |
| 83 | public void loadExistentTypedClass() { | 80 | public void loadExistentTypedClass() { |
| 84 | - Class<MyClass> expected = MyClass.class; | ||
| 85 | - | ||
| 86 | - assertEquals(expected, propertiesExistentConfig.getExistentTypedClass()); | 81 | + assertEquals(MyClass.class, propertiesExistentConfig.getExistentTypedClass()); |
| 87 | } | 82 | } |
| 88 | 83 | ||
| 89 | @Test | 84 | @Test |
| 90 | public void loadExistentUntypedClass() { | 85 | public void loadExistentUntypedClass() { |
| 91 | - Class<?> expected = MyClass.class; | ||
| 92 | - | ||
| 93 | - assertEquals(expected, propertiesExistentConfig.getExistentUntypedClass()); | 86 | + assertEquals(MyClass.class, propertiesExistentConfig.getExistentUntypedClass()); |
| 94 | } | 87 | } |
| 95 | 88 | ||
| 96 | @Test | 89 | @Test |
| @@ -112,12 +105,4 @@ public class ConfigurationClassFieldTest extends AbstractConfigurationTest { | @@ -112,12 +105,4 @@ public class ConfigurationClassFieldTest extends AbstractConfigurationTest { | ||
| 112 | assertEquals(ClassNotFoundException.class, cause.getCause().getClass()); | 105 | assertEquals(ClassNotFoundException.class, cause.getCause().getClass()); |
| 113 | } | 106 | } |
| 114 | } | 107 | } |
| 115 | - | ||
| 116 | - @Test(expected = ClassCastException.class) | ||
| 117 | - public void loadForcingClassCastException() throws IllegalAccessException, InstantiationException { | ||
| 118 | - Class<MyClass> clazz = propertiesCastConfig.getForcingClassCastException(); | ||
| 119 | - | ||
| 120 | - @SuppressWarnings("unused") | ||
| 121 | - MyClass myClass = clazz.newInstance(); | ||
| 122 | - } | ||
| 123 | } | 108 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/PropertiesClassCastFieldConfig.java
| @@ -1,45 +0,0 @@ | @@ -1,45 +0,0 @@ | ||
| 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 | - */ | ||
| 37 | -package br.gov.frameworkdemoiselle.configuration.field.clazz; | ||
| 38 | - | ||
| 39 | -import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES; | ||
| 40 | -import br.gov.frameworkdemoiselle.configuration.Configuration; | ||
| 41 | - | ||
| 42 | -@Configuration(type = PROPERTIES) | ||
| 43 | -public class PropertiesClassCastFieldConfig extends AbstractClassCastFieldConfig { | ||
| 44 | - | ||
| 45 | -} |
impl/core/src/test/resources/configuration/field/class/demoiselle.properties
| @@ -37,4 +37,3 @@ existentTypedClass=br.gov.frameworkdemoiselle.configuration.field.clazz.MyClass | @@ -37,4 +37,3 @@ existentTypedClass=br.gov.frameworkdemoiselle.configuration.field.clazz.MyClass | ||
| 37 | existentUntypedClass=br.gov.frameworkdemoiselle.configuration.field.clazz.MyClass | 37 | existentUntypedClass=br.gov.frameworkdemoiselle.configuration.field.clazz.MyClass |
| 38 | nonExistentTypedClass=com.fake.NonExistentClass | 38 | nonExistentTypedClass=com.fake.NonExistentClass |
| 39 | nonExistentUntypedClass=com.fake.NonExistentClass | 39 | nonExistentUntypedClass=com.fake.NonExistentClass |
| 40 | -forcingClassCastException=java.lang.String |