diff --git a/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/ConfigurationDefaultValueTest.java b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/ConfigurationDefaultValueTest.java index 3d58ab1..40b0caf 100644 --- a/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/ConfigurationDefaultValueTest.java +++ b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/ConfigurationDefaultValueTest.java @@ -90,6 +90,6 @@ public class ConfigurationDefaultValueTest extends AbstractConfigurationTest { public void loadDefaultValueWithKey() { assertEquals("Initialized value of the property file", filledFieldConfig.getStringDefaultWithKey()); assertEquals("Initialized value and key in the property file", noFileConfig.getStringDefaultWithKey()); - assertEquals("", emptyFieldsConfig.getStringDefaultWithKey()); + assertEquals("Initialized value and key in the property file", emptyFieldsConfig.getStringDefaultWithKey()); } } diff --git a/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/AbstractNullClassFieldConfig.java b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/AbstractNullClassFieldConfig.java new file mode 100644 index 0000000..7b35374 --- /dev/null +++ b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/AbstractNullClassFieldConfig.java @@ -0,0 +1,52 @@ +/* + * 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 br.gov.frameworkdemoiselle.configuration.field.clazz; + +public abstract class AbstractNullClassFieldConfig { + + private Class nullTypedClass; + + private Class nullUntypedClass; + + public Class getNullTypedClass() { + return nullTypedClass; + } + + public Class getNullUntypedClass() { + return nullUntypedClass; + } +} diff --git a/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/ConfigurationClassFieldTest.java b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/ConfigurationClassFieldTest.java index ffa6a5f..22be0ff 100644 --- a/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/ConfigurationClassFieldTest.java +++ b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/ConfigurationClassFieldTest.java @@ -61,6 +61,9 @@ public class ConfigurationClassFieldTest extends AbstractConfigurationTest { @Inject private PropertiesClassNotFoundFieldConfig propertiesNotFoundConfig; + + @Inject + private PropertiesNullClassFieldConfig propertiesNullFieldConfig; @Deployment public static JavaArchive createDeployment() { @@ -69,9 +72,7 @@ public class ConfigurationClassFieldTest extends AbstractConfigurationTest { deployment.addPackages(true, ConfigurationClassFieldTest.class.getPackage()); deployment.addAsResource( new FileAsset(new File("src/test/resources/configuration/field/class/demoiselle.properties")), - "demoiselle.properties").addAsResource( - new FileAsset(new File("src/test/resources/configuration/field/class/demoiselle.xml")), - "demoiselle.xml"); + "demoiselle.properties"); return deployment; } @@ -105,4 +106,16 @@ public class ConfigurationClassFieldTest extends AbstractConfigurationTest { assertEquals(ClassNotFoundException.class, cause.getCause().getClass()); } } + + @Test + public void loadNullTypedClass() { + assertEquals(null, propertiesNullFieldConfig.getNullTypedClass()); + } + + @Test + public void loadNullUntypedClass() { + assertEquals(null, propertiesNullFieldConfig.getNullUntypedClass()); + } + + } diff --git a/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/PropertiesNullClassFieldConfig.java b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/PropertiesNullClassFieldConfig.java new file mode 100644 index 0000000..317b9ab --- /dev/null +++ b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/clazz/PropertiesNullClassFieldConfig.java @@ -0,0 +1,45 @@ +/* + * 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 br.gov.frameworkdemoiselle.configuration.field.clazz; + +import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES; +import br.gov.frameworkdemoiselle.configuration.Configuration; + +@Configuration(type = PROPERTIES) +public class PropertiesNullClassFieldConfig extends AbstractNullClassFieldConfig { + +} diff --git a/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/string/ConfigurationStringFieldTest.java b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/string/ConfigurationStringFieldTest.java index 7d707ee..e2a1d97 100644 --- a/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/string/ConfigurationStringFieldTest.java +++ b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/string/ConfigurationStringFieldTest.java @@ -105,7 +105,7 @@ public class ConfigurationStringFieldTest extends AbstractConfigurationTest { @Test public void loadEmptyString() { - String expected = ""; + String expected = null; assertEquals(expected, systemConfig.getEmptyString()); assertEquals(expected, propertiesConfig.getEmptyString()); assertEquals(expected, xmlConfig.getEmptyString()); diff --git a/impl/core/src/test/resources/configuration/field/class/demoiselle.properties b/impl/core/src/test/resources/configuration/field/class/demoiselle.properties index 3c34314..9f3d316 100644 --- a/impl/core/src/test/resources/configuration/field/class/demoiselle.properties +++ b/impl/core/src/test/resources/configuration/field/class/demoiselle.properties @@ -37,3 +37,5 @@ existentTypedClass=br.gov.frameworkdemoiselle.configuration.field.clazz.MyClass existentUntypedClass=br.gov.frameworkdemoiselle.configuration.field.clazz.MyClass nonExistentTypedClass=com.fake.NonExistentClass nonExistentUntypedClass=com.fake.NonExistentClass +nullTypedClass= +nullUntypedClass= -- libgit2 0.21.2