From 4d0a3ad0fba70ed8e51abb0cb4cb4b7cbbcf1b66 Mon Sep 17 00:00:00 2001 From: Emerson Oliveira Date: Tue, 2 Apr 2013 17:30:50 -0300 Subject: [PATCH] Ajustes nos testes --- impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/AbstractNotNullFieldConfig.java | 4 ---- impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/ConfigurationNotNullFieldTest.java | 49 +++++++++++++++++++++++++------------------------ impl/core/src/test/resources/configuration/field/array/demoiselle.properties | 21 ++++++++++++++++++++- impl/core/src/test/resources/configuration/field/basic/demoiselle.properties | 2 +- impl/core/src/test/resources/configuration/field/basic/demoiselle.xml | 2 +- 5 files changed, 47 insertions(+), 31 deletions(-) diff --git a/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/AbstractNotNullFieldConfig.java b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/AbstractNotNullFieldConfig.java index 4f7b94c..cef34d4 100644 --- a/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/AbstractNotNullFieldConfig.java +++ b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/AbstractNotNullFieldConfig.java @@ -46,8 +46,4 @@ public abstract class AbstractNotNullFieldConfig { public Integer getIntegerNotNull() { return integerNotNull; } - - public void setIntegerNotNull(Integer integerNotNull) { - this.integerNotNull = integerNotNull; - } } diff --git a/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/ConfigurationNotNullFieldTest.java b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/ConfigurationNotNullFieldTest.java index cc2caa3..005d3a8 100644 --- a/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/ConfigurationNotNullFieldTest.java +++ b/impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/ConfigurationNotNullFieldTest.java @@ -57,54 +57,55 @@ public class ConfigurationNotNullFieldTest extends AbstractConfigurationTest { @Inject private PropertyWithFilledFieldConfig filledFieldConfig; - + @Inject private PropertyWithEmptyFieldConfig emptyFieldsConfig; - + @Inject private PropertyWithoutNotNullField withoutNotNullField; @Inject private PropertyWithoutFileConfig noFileConfig; - + @Deployment public static JavaArchive createDeployment() { JavaArchive deployment = createConfigurationDeployment(); deployment.addPackages(true, ConfigurationNotNullFieldTest.class.getPackage()); - deployment.addAsResource( - new FileAsset(new File("src/test/resources/configuration/field/notnull/demoiselle.properties")), - "demoiselle.properties").addAsResource( - new FileAsset(new File("src/test/resources/configuration/field/notnull/empty-field.properties")), - "empty-field.properties").addAsResource( - new FileAsset(new File("src/test/resources/configuration/field/notnull/without-field.properties")), - "without-field.properties"); + deployment + .addAsResource( + new FileAsset(new File("src/test/resources/configuration/field/notnull/demoiselle.properties")), + "demoiselle.properties") + .addAsResource( + new FileAsset(new File("src/test/resources/configuration/field/notnull/empty-field.properties")), + "empty-field.properties") + .addAsResource( + new FileAsset(new File( + "src/test/resources/configuration/field/notnull/without-field.properties")), + "without-field.properties"); return deployment; } - + @Test - public void loadFieldNotNullFromFilledProperty(){ + public void loadFieldNotNullFromFilledProperty() { Integer expected = 1; - + assertEquals(expected, filledFieldConfig.getIntegerNotNull()); } - + @Test(expected = ConfigurationException.class) - public void loadFieldNotNullFromEmptyProperty(){ + public void loadFieldNotNullFromEmptyProperty() { emptyFieldsConfig.getIntegerNotNull(); } - + @Test(expected = ConfigurationException.class) - public void loadFieldFromPropertyFileWithoutNotNullField(){ + public void loadFieldFromPropertyFileWithoutNotNullField() { withoutNotNullField.getIntegerNotNull(); } - - @Test//(expected = ConfigurationException.class) - /*TODO: Lançar exceção quando o arquivo de propriedade declarado pela - * classe de configuração que contenha um atributo anotado com @NotNull - * não existir */ - public void loadFieldNotNullFromInexistentPropertyFile(){ + + @Test(expected = ConfigurationException.class) + public void loadFieldNotNullFromInexistentPropertyFile() { noFileConfig.getIntegerNotNull(); - } + } } diff --git a/impl/core/src/test/resources/configuration/field/array/demoiselle.properties b/impl/core/src/test/resources/configuration/field/array/demoiselle.properties index 9ea5b99..68775a4 100644 --- a/impl/core/src/test/resources/configuration/field/array/demoiselle.properties +++ b/impl/core/src/test/resources/configuration/field/array/demoiselle.properties @@ -33,4 +33,23 @@ # ou escreva para a Fundação do Software Livre (FSF) Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. -primitiveIntegers=1,20,0 +primitiveIntegers=1 +primitiveIntegers=20 +primitiveIntegers=0 + +wrappedIntegers=-99 +wrappedIntegers=0 +wrappedIntegers=1 + +strings=demoisele +strings=demoiselle framework +strings=demoiselle,framework +strings=demoiselle, framework + +primitiveDoubles=-10 +primitiveDoubles=200000.99999 +primitiveDoubles=0 + +wrappedDoubles=-456.123456789 +wrappedDoubles=0.0 +wrappedDoubles=52.2 diff --git a/impl/core/src/test/resources/configuration/field/basic/demoiselle.properties b/impl/core/src/test/resources/configuration/field/basic/demoiselle.properties index d923a9b..481339c 100644 --- a/impl/core/src/test/resources/configuration/field/basic/demoiselle.properties +++ b/impl/core/src/test/resources/configuration/field/basic/demoiselle.properties @@ -36,4 +36,4 @@ primitiveInteger=1 wrappedInteger=2 stringWithSpace=demoiselle framework -stringWithComma=demoiselle,framework +stringWithComma=demoiselle, framework diff --git a/impl/core/src/test/resources/configuration/field/basic/demoiselle.xml b/impl/core/src/test/resources/configuration/field/basic/demoiselle.xml index 62ee827..91b0cd2 100644 --- a/impl/core/src/test/resources/configuration/field/basic/demoiselle.xml +++ b/impl/core/src/test/resources/configuration/field/basic/demoiselle.xml @@ -39,5 +39,5 @@ 1 2 demoiselle framework - demoiselle,framework + demoiselle, framework -- libgit2 0.21.2