Commit 4d0a3ad0fba70ed8e51abb0cb4cb4b7cbbcf1b66
1 parent
392ab62c
Exists in
master
Ajustes nos testes
Showing
5 changed files
with
47 additions
and
31 deletions
Show diff stats
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/AbstractNotNullFieldConfig.java
@@ -46,8 +46,4 @@ public abstract class AbstractNotNullFieldConfig { | @@ -46,8 +46,4 @@ public abstract class AbstractNotNullFieldConfig { | ||
46 | public Integer getIntegerNotNull() { | 46 | public Integer getIntegerNotNull() { |
47 | return integerNotNull; | 47 | return integerNotNull; |
48 | } | 48 | } |
49 | - | ||
50 | - public void setIntegerNotNull(Integer integerNotNull) { | ||
51 | - this.integerNotNull = integerNotNull; | ||
52 | - } | ||
53 | } | 49 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/ConfigurationNotNullFieldTest.java
@@ -57,54 +57,55 @@ public class ConfigurationNotNullFieldTest extends AbstractConfigurationTest { | @@ -57,54 +57,55 @@ public class ConfigurationNotNullFieldTest extends AbstractConfigurationTest { | ||
57 | 57 | ||
58 | @Inject | 58 | @Inject |
59 | private PropertyWithFilledFieldConfig filledFieldConfig; | 59 | private PropertyWithFilledFieldConfig filledFieldConfig; |
60 | - | 60 | + |
61 | @Inject | 61 | @Inject |
62 | private PropertyWithEmptyFieldConfig emptyFieldsConfig; | 62 | private PropertyWithEmptyFieldConfig emptyFieldsConfig; |
63 | - | 63 | + |
64 | @Inject | 64 | @Inject |
65 | private PropertyWithoutNotNullField withoutNotNullField; | 65 | private PropertyWithoutNotNullField withoutNotNullField; |
66 | 66 | ||
67 | @Inject | 67 | @Inject |
68 | private PropertyWithoutFileConfig noFileConfig; | 68 | private PropertyWithoutFileConfig noFileConfig; |
69 | - | 69 | + |
70 | @Deployment | 70 | @Deployment |
71 | public static JavaArchive createDeployment() { | 71 | public static JavaArchive createDeployment() { |
72 | JavaArchive deployment = createConfigurationDeployment(); | 72 | JavaArchive deployment = createConfigurationDeployment(); |
73 | 73 | ||
74 | deployment.addPackages(true, ConfigurationNotNullFieldTest.class.getPackage()); | 74 | deployment.addPackages(true, ConfigurationNotNullFieldTest.class.getPackage()); |
75 | - deployment.addAsResource( | ||
76 | - new FileAsset(new File("src/test/resources/configuration/field/notnull/demoiselle.properties")), | ||
77 | - "demoiselle.properties").addAsResource( | ||
78 | - new FileAsset(new File("src/test/resources/configuration/field/notnull/empty-field.properties")), | ||
79 | - "empty-field.properties").addAsResource( | ||
80 | - new FileAsset(new File("src/test/resources/configuration/field/notnull/without-field.properties")), | ||
81 | - "without-field.properties"); | 75 | + deployment |
76 | + .addAsResource( | ||
77 | + new FileAsset(new File("src/test/resources/configuration/field/notnull/demoiselle.properties")), | ||
78 | + "demoiselle.properties") | ||
79 | + .addAsResource( | ||
80 | + new FileAsset(new File("src/test/resources/configuration/field/notnull/empty-field.properties")), | ||
81 | + "empty-field.properties") | ||
82 | + .addAsResource( | ||
83 | + new FileAsset(new File( | ||
84 | + "src/test/resources/configuration/field/notnull/without-field.properties")), | ||
85 | + "without-field.properties"); | ||
82 | 86 | ||
83 | return deployment; | 87 | return deployment; |
84 | } | 88 | } |
85 | - | 89 | + |
86 | @Test | 90 | @Test |
87 | - public void loadFieldNotNullFromFilledProperty(){ | 91 | + public void loadFieldNotNullFromFilledProperty() { |
88 | Integer expected = 1; | 92 | Integer expected = 1; |
89 | - | 93 | + |
90 | assertEquals(expected, filledFieldConfig.getIntegerNotNull()); | 94 | assertEquals(expected, filledFieldConfig.getIntegerNotNull()); |
91 | } | 95 | } |
92 | - | 96 | + |
93 | @Test(expected = ConfigurationException.class) | 97 | @Test(expected = ConfigurationException.class) |
94 | - public void loadFieldNotNullFromEmptyProperty(){ | 98 | + public void loadFieldNotNullFromEmptyProperty() { |
95 | emptyFieldsConfig.getIntegerNotNull(); | 99 | emptyFieldsConfig.getIntegerNotNull(); |
96 | } | 100 | } |
97 | - | 101 | + |
98 | @Test(expected = ConfigurationException.class) | 102 | @Test(expected = ConfigurationException.class) |
99 | - public void loadFieldFromPropertyFileWithoutNotNullField(){ | 103 | + public void loadFieldFromPropertyFileWithoutNotNullField() { |
100 | withoutNotNullField.getIntegerNotNull(); | 104 | withoutNotNullField.getIntegerNotNull(); |
101 | } | 105 | } |
102 | - | ||
103 | - @Test//(expected = ConfigurationException.class) | ||
104 | - /*TODO: Lançar exceção quando o arquivo de propriedade declarado pela | ||
105 | - * classe de configuração que contenha um atributo anotado com @NotNull | ||
106 | - * não existir */ | ||
107 | - public void loadFieldNotNullFromInexistentPropertyFile(){ | 106 | + |
107 | + @Test(expected = ConfigurationException.class) | ||
108 | + public void loadFieldNotNullFromInexistentPropertyFile() { | ||
108 | noFileConfig.getIntegerNotNull(); | 109 | noFileConfig.getIntegerNotNull(); |
109 | - } | 110 | + } |
110 | } | 111 | } |
impl/core/src/test/resources/configuration/field/array/demoiselle.properties
@@ -33,4 +33,23 @@ | @@ -33,4 +33,23 @@ | ||
33 | # ou escreva para a Fundação do Software Livre (FSF) Inc., | 33 | # ou escreva para a Fundação do Software Livre (FSF) Inc., |
34 | # 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | 34 | # 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. |
35 | 35 | ||
36 | -primitiveIntegers=1,20,0 | 36 | +primitiveIntegers=1 |
37 | +primitiveIntegers=20 | ||
38 | +primitiveIntegers=0 | ||
39 | + | ||
40 | +wrappedIntegers=-99 | ||
41 | +wrappedIntegers=0 | ||
42 | +wrappedIntegers=1 | ||
43 | + | ||
44 | +strings=demoisele | ||
45 | +strings=demoiselle framework | ||
46 | +strings=demoiselle,framework | ||
47 | +strings=demoiselle, framework | ||
48 | + | ||
49 | +primitiveDoubles=-10 | ||
50 | +primitiveDoubles=200000.99999 | ||
51 | +primitiveDoubles=0 | ||
52 | + | ||
53 | +wrappedDoubles=-456.123456789 | ||
54 | +wrappedDoubles=0.0 | ||
55 | +wrappedDoubles=52.2 |
impl/core/src/test/resources/configuration/field/basic/demoiselle.properties
impl/core/src/test/resources/configuration/field/basic/demoiselle.xml
@@ -39,5 +39,5 @@ | @@ -39,5 +39,5 @@ | ||
39 | <primitiveInteger>1</primitiveInteger> | 39 | <primitiveInteger>1</primitiveInteger> |
40 | <wrappedInteger>2</wrappedInteger> | 40 | <wrappedInteger>2</wrappedInteger> |
41 | <stringWithSpace>demoiselle framework</stringWithSpace> | 41 | <stringWithSpace>demoiselle framework</stringWithSpace> |
42 | - <stringWithComma>demoiselle,framework</stringWithComma> | 42 | + <stringWithComma>demoiselle, framework</stringWithComma> |
43 | </configuration> | 43 | </configuration> |