Commit f11975b0073c38de061d2e0cc03b9c7a6f601a9f
1 parent
b5da3754
Exists in
master
Formatação do código e inclusão do teste de prefixos que finalizam com
"."
Showing
23 changed files
with
72 additions
and
64 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/ConfigurationLoader.java
@@ -220,12 +220,12 @@ public class ConfigurationLoader implements Serializable { | @@ -220,12 +220,12 @@ public class ConfigurationLoader implements Serializable { | ||
220 | } | 220 | } |
221 | 221 | ||
222 | private String getKey(Field field) { | 222 | private String getKey(Field field) { |
223 | - String key = ""; | 223 | + String key; |
224 | 224 | ||
225 | if (field.isAnnotationPresent(Name.class)) { | 225 | if (field.isAnnotationPresent(Name.class)) { |
226 | - key += field.getAnnotation(Name.class).value(); | 226 | + key = field.getAnnotation(Name.class).value(); |
227 | } else { | 227 | } else { |
228 | - key += field.getName(); | 228 | + key = field.getName(); |
229 | } | 229 | } |
230 | 230 | ||
231 | return key; | 231 | return key; |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/AbstractDefaultValueConfig.java
@@ -36,17 +36,16 @@ | @@ -36,17 +36,16 @@ | ||
36 | */ | 36 | */ |
37 | package br.gov.frameworkdemoiselle.configuration.defaultvalue; | 37 | package br.gov.frameworkdemoiselle.configuration.defaultvalue; |
38 | 38 | ||
39 | - | ||
40 | public abstract class AbstractDefaultValueConfig { | 39 | public abstract class AbstractDefaultValueConfig { |
41 | 40 | ||
42 | private String stringDefaultWithoutKey = "Initialized value and without key in the property file"; | 41 | private String stringDefaultWithoutKey = "Initialized value and without key in the property file"; |
43 | - | 42 | + |
44 | private String stringDefaultWithKey = "Initialized value and key in the property file"; | 43 | private String stringDefaultWithKey = "Initialized value and key in the property file"; |
45 | - | 44 | + |
46 | public String getStringDefaultWithoutKey() { | 45 | public String getStringDefaultWithoutKey() { |
47 | return stringDefaultWithoutKey; | 46 | return stringDefaultWithoutKey; |
48 | } | 47 | } |
49 | - | 48 | + |
50 | public String getStringDefaultWithKey() { | 49 | public String getStringDefaultWithKey() { |
51 | return stringDefaultWithKey; | 50 | return stringDefaultWithKey; |
52 | } | 51 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/ConfigurationDefaultValueTest.java
@@ -58,13 +58,13 @@ public class ConfigurationDefaultValueTest extends AbstractConfigurationTest { | @@ -58,13 +58,13 @@ public class ConfigurationDefaultValueTest extends AbstractConfigurationTest { | ||
58 | 58 | ||
59 | @Inject | 59 | @Inject |
60 | private FilledDefaultValueConfig filledFieldConfig; | 60 | private FilledDefaultValueConfig filledFieldConfig; |
61 | - | 61 | + |
62 | @Inject | 62 | @Inject |
63 | private EmptyDefaultValueConfig emptyFieldsConfig; | 63 | private EmptyDefaultValueConfig emptyFieldsConfig; |
64 | - | 64 | + |
65 | @Inject | 65 | @Inject |
66 | private PropertyWithInexistenceFileConfig noFileConfig; | 66 | private PropertyWithInexistenceFileConfig noFileConfig; |
67 | - | 67 | + |
68 | @Deployment | 68 | @Deployment |
69 | public static JavaArchive createDeployment() { | 69 | public static JavaArchive createDeployment() { |
70 | JavaArchive deployment = createConfigurationDeployment(); | 70 | JavaArchive deployment = createConfigurationDeployment(); |
@@ -78,18 +78,18 @@ public class ConfigurationDefaultValueTest extends AbstractConfigurationTest { | @@ -78,18 +78,18 @@ public class ConfigurationDefaultValueTest extends AbstractConfigurationTest { | ||
78 | 78 | ||
79 | return deployment; | 79 | return deployment; |
80 | } | 80 | } |
81 | - | 81 | + |
82 | @Test | 82 | @Test |
83 | - public void loadDefaultValueWithoutKey(){ | 83 | + public void loadDefaultValueWithoutKey() { |
84 | String expected = "Initialized value and without key in the property file"; | 84 | String expected = "Initialized value and without key in the property file"; |
85 | - | 85 | + |
86 | assertEquals(expected, filledFieldConfig.getStringDefaultWithoutKey()); | 86 | assertEquals(expected, filledFieldConfig.getStringDefaultWithoutKey()); |
87 | assertEquals(expected, emptyFieldsConfig.getStringDefaultWithoutKey()); | 87 | assertEquals(expected, emptyFieldsConfig.getStringDefaultWithoutKey()); |
88 | assertEquals(expected, noFileConfig.getStringDefaultWithoutKey()); | 88 | assertEquals(expected, noFileConfig.getStringDefaultWithoutKey()); |
89 | } | 89 | } |
90 | - | 90 | + |
91 | @Test | 91 | @Test |
92 | - public void loadDefaultValueWithKey(){ | 92 | + public void loadDefaultValueWithKey() { |
93 | assertEquals("Initialized value of the property file", filledFieldConfig.getStringDefaultWithKey()); | 93 | assertEquals("Initialized value of the property file", filledFieldConfig.getStringDefaultWithKey()); |
94 | assertEquals("Initialized value and key in the property file", noFileConfig.getStringDefaultWithKey()); | 94 | assertEquals("Initialized value and key in the property file", noFileConfig.getStringDefaultWithKey()); |
95 | assertEquals("", emptyFieldsConfig.getStringDefaultWithKey()); | 95 | assertEquals("", emptyFieldsConfig.getStringDefaultWithKey()); |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/EmptyDefaultValueConfig.java
@@ -40,5 +40,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML; | @@ -40,5 +40,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML; | ||
40 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 40 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
41 | 41 | ||
42 | @Configuration(resource = "demoiselle", type = XML) | 42 | @Configuration(resource = "demoiselle", type = XML) |
43 | -public class EmptyDefaultValueConfig extends AbstractDefaultValueConfig{ | 43 | +public class EmptyDefaultValueConfig extends AbstractDefaultValueConfig { |
44 | } | 44 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/FilledDefaultValueConfig.java
@@ -40,5 +40,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES; | @@ -40,5 +40,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES; | ||
40 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 40 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
41 | 41 | ||
42 | @Configuration(resource = "demoiselle", type = PROPERTIES) | 42 | @Configuration(resource = "demoiselle", type = PROPERTIES) |
43 | -public class FilledDefaultValueConfig extends AbstractDefaultValueConfig{ | 43 | +public class FilledDefaultValueConfig extends AbstractDefaultValueConfig { |
44 | } | 44 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/defaultvalue/PropertyWithInexistenceFileConfig.java
@@ -39,5 +39,5 @@ package br.gov.frameworkdemoiselle.configuration.defaultvalue; | @@ -39,5 +39,5 @@ package br.gov.frameworkdemoiselle.configuration.defaultvalue; | ||
39 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 39 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
40 | 40 | ||
41 | @Configuration(resource = "nofile") | 41 | @Configuration(resource = "nofile") |
42 | -public class PropertyWithInexistenceFileConfig extends AbstractDefaultValueConfig{ | 42 | +public class PropertyWithInexistenceFileConfig extends AbstractDefaultValueConfig { |
43 | } | 43 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/array/ConfigurationArrayFieldTest.java
@@ -56,7 +56,7 @@ public class ConfigurationArrayFieldTest extends AbstractConfigurationTest { | @@ -56,7 +56,7 @@ public class ConfigurationArrayFieldTest extends AbstractConfigurationTest { | ||
56 | 56 | ||
57 | @Inject | 57 | @Inject |
58 | private PropertiesArrayFieldConfig propertiesConfig; | 58 | private PropertiesArrayFieldConfig propertiesConfig; |
59 | - | 59 | + |
60 | @Inject | 60 | @Inject |
61 | private XMLArrayFieldConfig xmlConfig; | 61 | private XMLArrayFieldConfig xmlConfig; |
62 | 62 | ||
@@ -65,10 +65,11 @@ public class ConfigurationArrayFieldTest extends AbstractConfigurationTest { | @@ -65,10 +65,11 @@ public class ConfigurationArrayFieldTest extends AbstractConfigurationTest { | ||
65 | JavaArchive deployment = createConfigurationDeployment(); | 65 | JavaArchive deployment = createConfigurationDeployment(); |
66 | 66 | ||
67 | deployment.addPackages(true, ConfigurationArrayFieldTest.class.getPackage()); | 67 | deployment.addPackages(true, ConfigurationArrayFieldTest.class.getPackage()); |
68 | - deployment.addAsResource(new FileAsset(new File( | ||
69 | - "src/test/resources/configuration/field/array/demoiselle.properties")), "demoiselle.properties") | ||
70 | - .addAsResource(new FileAsset(new File("src/test/resources/configuration/field/array/demoiselle.xml")), | ||
71 | - "demoiselle.xml"); | 68 | + deployment.addAsResource( |
69 | + new FileAsset(new File("src/test/resources/configuration/field/array/demoiselle.properties")), | ||
70 | + "demoiselle.properties").addAsResource( | ||
71 | + new FileAsset(new File("src/test/resources/configuration/field/array/demoiselle.xml")), | ||
72 | + "demoiselle.xml"); | ||
72 | 73 | ||
73 | return deployment; | 74 | return deployment; |
74 | } | 75 | } |
@@ -92,19 +93,19 @@ public class ConfigurationArrayFieldTest extends AbstractConfigurationTest { | @@ -92,19 +93,19 @@ public class ConfigurationArrayFieldTest extends AbstractConfigurationTest { | ||
92 | @Test | 93 | @Test |
93 | public void loadString() { | 94 | public void loadString() { |
94 | String[] expected = { "demoisele", "demoiselle framework", "demoiselle,framework", "demoiselle, framework" }; | 95 | String[] expected = { "demoisele", "demoiselle framework", "demoiselle,framework", "demoiselle, framework" }; |
95 | - | 96 | + |
96 | assertArrayEquals(expected, propertiesConfig.getStrings()); | 97 | assertArrayEquals(expected, propertiesConfig.getStrings()); |
97 | assertArrayEquals(expected, xmlConfig.getStrings()); | 98 | assertArrayEquals(expected, xmlConfig.getStrings()); |
98 | } | 99 | } |
99 | - | 100 | + |
100 | @Test | 101 | @Test |
101 | - public void loadPrimitiveDoubles(){ | 102 | + public void loadPrimitiveDoubles() { |
102 | double[] expected = { -10, 200000.99999, 0 }; | 103 | double[] expected = { -10, 200000.99999, 0 }; |
103 | 104 | ||
104 | assertArrayEquals(expected, propertiesConfig.getPrimitiveDoubles(), 0); | 105 | assertArrayEquals(expected, propertiesConfig.getPrimitiveDoubles(), 0); |
105 | assertArrayEquals(expected, xmlConfig.getPrimitiveDoubles(), 0); | 106 | assertArrayEquals(expected, xmlConfig.getPrimitiveDoubles(), 0); |
106 | } | 107 | } |
107 | - | 108 | + |
108 | @Test | 109 | @Test |
109 | public void loadWrappedDoubles() { | 110 | public void loadWrappedDoubles() { |
110 | Double[] expected = { -456.123456789, 0.0, 52.2 }; | 111 | Double[] expected = { -456.123456789, 0.0, 52.2 }; |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/ignored/AbstractIgnoredFieldConfig.java
@@ -42,7 +42,7 @@ public abstract class AbstractIgnoredFieldConfig { | @@ -42,7 +42,7 @@ public abstract class AbstractIgnoredFieldConfig { | ||
42 | 42 | ||
43 | @Ignore | 43 | @Ignore |
44 | private int ignoredInt; | 44 | private int ignoredInt; |
45 | - | 45 | + |
46 | public int getIgnoredInt() { | 46 | public int getIgnoredInt() { |
47 | return ignoredInt; | 47 | return ignoredInt; |
48 | } | 48 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/ignored/ConfigurationIgnoredFieldTest.java
@@ -56,13 +56,13 @@ public class ConfigurationIgnoredFieldTest extends AbstractConfigurationTest { | @@ -56,13 +56,13 @@ public class ConfigurationIgnoredFieldTest extends AbstractConfigurationTest { | ||
56 | 56 | ||
57 | @Inject | 57 | @Inject |
58 | private FilledIgnoredFieldConfig filledFieldConfig; | 58 | private FilledIgnoredFieldConfig filledFieldConfig; |
59 | - | 59 | + |
60 | @Inject | 60 | @Inject |
61 | private EmptyIgnoredFieldConfig emptyFieldsConfig; | 61 | private EmptyIgnoredFieldConfig emptyFieldsConfig; |
62 | - | 62 | + |
63 | @Inject | 63 | @Inject |
64 | private PropertyWithoutFileConfig noFileConfig; | 64 | private PropertyWithoutFileConfig noFileConfig; |
65 | - | 65 | + |
66 | @Deployment | 66 | @Deployment |
67 | public static JavaArchive createDeployment() { | 67 | public static JavaArchive createDeployment() { |
68 | JavaArchive deployment = createConfigurationDeployment(); | 68 | JavaArchive deployment = createConfigurationDeployment(); |
@@ -76,11 +76,11 @@ public class ConfigurationIgnoredFieldTest extends AbstractConfigurationTest { | @@ -76,11 +76,11 @@ public class ConfigurationIgnoredFieldTest extends AbstractConfigurationTest { | ||
76 | 76 | ||
77 | return deployment; | 77 | return deployment; |
78 | } | 78 | } |
79 | - | 79 | + |
80 | @Test | 80 | @Test |
81 | - public void loadIgnoredInt(){ | 81 | + public void loadIgnoredInt() { |
82 | int expected = 0; | 82 | int expected = 0; |
83 | - | 83 | + |
84 | assertEquals(expected, filledFieldConfig.getIgnoredInt()); | 84 | assertEquals(expected, filledFieldConfig.getIgnoredInt()); |
85 | assertEquals(expected, noFileConfig.getIgnoredInt()); | 85 | assertEquals(expected, noFileConfig.getIgnoredInt()); |
86 | assertEquals(expected, emptyFieldsConfig.getIgnoredInt()); | 86 | assertEquals(expected, emptyFieldsConfig.getIgnoredInt()); |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/ignored/EmptyIgnoredFieldConfig.java
@@ -40,5 +40,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML; | @@ -40,5 +40,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.XML; | ||
40 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 40 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
41 | 41 | ||
42 | @Configuration(resource = "demoiselle", type = XML) | 42 | @Configuration(resource = "demoiselle", type = XML) |
43 | -public class EmptyIgnoredFieldConfig extends AbstractIgnoredFieldConfig{ | 43 | +public class EmptyIgnoredFieldConfig extends AbstractIgnoredFieldConfig { |
44 | } | 44 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/ignored/FilledIgnoredFieldConfig.java
@@ -40,5 +40,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES; | @@ -40,5 +40,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES; | ||
40 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 40 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
41 | 41 | ||
42 | @Configuration(resource = "demoiselle", type = PROPERTIES) | 42 | @Configuration(resource = "demoiselle", type = PROPERTIES) |
43 | -public class FilledIgnoredFieldConfig extends AbstractIgnoredFieldConfig{ | 43 | +public class FilledIgnoredFieldConfig extends AbstractIgnoredFieldConfig { |
44 | } | 44 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/ignored/PropertyWithoutFileConfig.java
@@ -39,5 +39,5 @@ package br.gov.frameworkdemoiselle.configuration.field.ignored; | @@ -39,5 +39,5 @@ package br.gov.frameworkdemoiselle.configuration.field.ignored; | ||
39 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 39 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
40 | 40 | ||
41 | @Configuration(resource = "nofile") | 41 | @Configuration(resource = "nofile") |
42 | -public class PropertyWithoutFileConfig extends AbstractIgnoredFieldConfig{ | 42 | +public class PropertyWithoutFileConfig extends AbstractIgnoredFieldConfig { |
43 | } | 43 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/named/AbstractNamedFieldConfig.java
@@ -38,18 +38,17 @@ package br.gov.frameworkdemoiselle.configuration.field.named; | @@ -38,18 +38,17 @@ package br.gov.frameworkdemoiselle.configuration.field.named; | ||
38 | 38 | ||
39 | import br.gov.frameworkdemoiselle.annotation.Name; | 39 | import br.gov.frameworkdemoiselle.annotation.Name; |
40 | 40 | ||
41 | - | ||
42 | public abstract class AbstractNamedFieldConfig { | 41 | public abstract class AbstractNamedFieldConfig { |
43 | 42 | ||
44 | @Name("main.int") | 43 | @Name("main.int") |
45 | private int intUniqueName; | 44 | private int intUniqueName; |
46 | - | 45 | + |
47 | @Name("nonexistent.property") | 46 | @Name("nonexistent.property") |
48 | private int intNotPresent; | 47 | private int intNotPresent; |
49 | - | 48 | + |
50 | @Name("attribute.without.file") | 49 | @Name("attribute.without.file") |
51 | private int intNamedWithoutFile; | 50 | private int intNamedWithoutFile; |
52 | - | 51 | + |
53 | public int getIntUniqueName() { | 52 | public int getIntUniqueName() { |
54 | return intUniqueName; | 53 | return intUniqueName; |
55 | } | 54 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/AbstractNotNullFieldConfig.java
@@ -42,7 +42,7 @@ public abstract class AbstractNotNullFieldConfig { | @@ -42,7 +42,7 @@ public abstract class AbstractNotNullFieldConfig { | ||
42 | 42 | ||
43 | @NotNull | 43 | @NotNull |
44 | private Integer integerNotNull; | 44 | private Integer integerNotNull; |
45 | - | 45 | + |
46 | public Integer getIntegerNotNull() { | 46 | public Integer getIntegerNotNull() { |
47 | return integerNotNull; | 47 | return integerNotNull; |
48 | } | 48 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/PropertyWithEmptyFieldConfig.java
@@ -40,5 +40,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES; | @@ -40,5 +40,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES; | ||
40 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 40 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
41 | 41 | ||
42 | @Configuration(resource = "empty-field", type = PROPERTIES) | 42 | @Configuration(resource = "empty-field", type = PROPERTIES) |
43 | -public class PropertyWithEmptyFieldConfig extends AbstractNotNullFieldConfig{ | 43 | +public class PropertyWithEmptyFieldConfig extends AbstractNotNullFieldConfig { |
44 | } | 44 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/PropertyWithFilledFieldConfig.java
@@ -40,5 +40,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES; | @@ -40,5 +40,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES; | ||
40 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 40 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
41 | 41 | ||
42 | @Configuration(resource = "demoiselle", type = PROPERTIES) | 42 | @Configuration(resource = "demoiselle", type = PROPERTIES) |
43 | -public class PropertyWithFilledFieldConfig extends AbstractNotNullFieldConfig{ | 43 | +public class PropertyWithFilledFieldConfig extends AbstractNotNullFieldConfig { |
44 | } | 44 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/PropertyWithoutFileConfig.java
@@ -39,5 +39,5 @@ package br.gov.frameworkdemoiselle.configuration.field.notnull; | @@ -39,5 +39,5 @@ package br.gov.frameworkdemoiselle.configuration.field.notnull; | ||
39 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 39 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
40 | 40 | ||
41 | @Configuration(resource = "nofile") | 41 | @Configuration(resource = "nofile") |
42 | -public class PropertyWithoutFileConfig extends AbstractNotNullFieldConfig{ | 42 | +public class PropertyWithoutFileConfig extends AbstractNotNullFieldConfig { |
43 | } | 43 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/field/notnull/PropertyWithoutNotNullField.java
@@ -4,5 +4,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES; | @@ -4,5 +4,5 @@ import static br.gov.frameworkdemoiselle.configuration.ConfigType.PROPERTIES; | ||
4 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 4 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
5 | 5 | ||
6 | @Configuration(resource = "without-field", type = PROPERTIES) | 6 | @Configuration(resource = "without-field", type = PROPERTIES) |
7 | -public class PropertyWithoutNotNullField extends AbstractNotNullFieldConfig{ | 7 | +public class PropertyWithoutNotNullField extends AbstractNotNullFieldConfig { |
8 | } | 8 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/ConfigurationPrefixTest.java
@@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
36 | */ | 36 | */ |
37 | package br.gov.frameworkdemoiselle.configuration.prefix; | 37 | package br.gov.frameworkdemoiselle.configuration.prefix; |
38 | 38 | ||
39 | +import static junit.framework.Assert.assertNull; | ||
39 | import static org.junit.Assert.assertEquals; | 40 | import static org.junit.Assert.assertEquals; |
40 | 41 | ||
41 | import java.io.File; | 42 | import java.io.File; |
@@ -56,29 +57,36 @@ public class ConfigurationPrefixTest extends AbstractConfigurationTest { | @@ -56,29 +57,36 @@ public class ConfigurationPrefixTest extends AbstractConfigurationTest { | ||
56 | 57 | ||
57 | @Inject | 58 | @Inject |
58 | private ExistentPrefix existentPrefix; | 59 | private ExistentPrefix existentPrefix; |
59 | - | 60 | + |
60 | @Inject | 61 | @Inject |
61 | private MissingPrefix missingPrefix; | 62 | private MissingPrefix missingPrefix; |
62 | - | 63 | + |
64 | + @Inject | ||
65 | + private PrefixEndingWithDot endingWithDotPrefix; | ||
66 | + | ||
63 | @Deployment | 67 | @Deployment |
64 | public static JavaArchive createDeployment() { | 68 | public static JavaArchive createDeployment() { |
65 | JavaArchive deployment = createConfigurationDeployment(); | 69 | JavaArchive deployment = createConfigurationDeployment(); |
66 | 70 | ||
67 | deployment.addPackages(true, ConfigurationPrefixTest.class.getPackage()); | 71 | deployment.addPackages(true, ConfigurationPrefixTest.class.getPackage()); |
68 | - deployment.addAsResource( | ||
69 | - new FileAsset(new File("src/test/resources/configuration/prefix/demoiselle.properties")), | ||
70 | - "demoiselle.properties"); | 72 | + deployment.addAsResource(new FileAsset( |
73 | + new File("src/test/resources/configuration/prefix/demoiselle.properties")), "demoiselle.properties"); | ||
71 | 74 | ||
72 | return deployment; | 75 | return deployment; |
73 | } | 76 | } |
74 | - | 77 | + |
75 | @Test | 78 | @Test |
76 | - public void loadFromPrefixedExistentProperty(){ | ||
77 | - assertEquals("Atributo com prefixo", existentPrefix.getPrefixedAttribute()); | 79 | + public void loadFromPrefixedExistentProperty() { |
80 | + assertEquals("with prefix", existentPrefix.getPrefixedAttribute()); | ||
78 | } | 81 | } |
79 | - | 82 | + |
83 | + @Test | ||
84 | + public void loadFromPrefixedWithouPrefixOnProperty() { | ||
85 | + assertNull(missingPrefix.getPrefixedAttribute()); | ||
86 | + } | ||
87 | + | ||
80 | @Test | 88 | @Test |
81 | - public void loadFromPrefixedWithouPrefixOnProperty(){ | ||
82 | - assertEquals(null, missingPrefix.getPrefixedAttribute()); | 89 | + public void loadPrefixEndingWithDot() { |
90 | + assertEquals("prefix ending with dot", endingWithDotPrefix.getPrefixedAttribute()); | ||
83 | } | 91 | } |
84 | } | 92 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/ExistentPrefix.java
@@ -2,6 +2,6 @@ package br.gov.frameworkdemoiselle.configuration.prefix; | @@ -2,6 +2,6 @@ package br.gov.frameworkdemoiselle.configuration.prefix; | ||
2 | 2 | ||
3 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 3 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
4 | 4 | ||
5 | -@Configuration(prefix="prefix.") | 5 | +@Configuration(prefix = "prefix") |
6 | public class ExistentPrefix extends AbstractPrefixConfig { | 6 | public class ExistentPrefix extends AbstractPrefixConfig { |
7 | } | 7 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/prefix/MissingPrefix.java
@@ -2,6 +2,6 @@ package br.gov.frameworkdemoiselle.configuration.prefix; | @@ -2,6 +2,6 @@ package br.gov.frameworkdemoiselle.configuration.prefix; | ||
2 | 2 | ||
3 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 3 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
4 | 4 | ||
5 | -@Configuration(prefix="missing.prefix.") | ||
6 | -public class MissingPrefix extends AbstractPrefixConfig{ | 5 | +@Configuration(prefix = "missing.prefix") |
6 | +public class MissingPrefix extends AbstractPrefixConfig { | ||
7 | } | 7 | } |
impl/core/src/test/java/br/gov/frameworkdemoiselle/configuration/scope/ConfigurationScopeTest.java
@@ -65,12 +65,12 @@ public class ConfigurationScopeTest extends AbstractConfigurationTest { | @@ -65,12 +65,12 @@ public class ConfigurationScopeTest extends AbstractConfigurationTest { | ||
65 | 65 | ||
66 | assertSame(config1, config2); | 66 | assertSame(config1, config2); |
67 | } | 67 | } |
68 | - | 68 | + |
69 | @Test | 69 | @Test |
70 | public void twoInvocationsDifferentInstances() { | 70 | public void twoInvocationsDifferentInstances() { |
71 | DependentScopeWithoutSuperClassConfig config1 = Beans.getReference(DependentScopeWithoutSuperClassConfig.class); | 71 | DependentScopeWithoutSuperClassConfig config1 = Beans.getReference(DependentScopeWithoutSuperClassConfig.class); |
72 | DependentScopeWithoutSuperClassConfig config2 = Beans.getReference(DependentScopeWithoutSuperClassConfig.class); | 72 | DependentScopeWithoutSuperClassConfig config2 = Beans.getReference(DependentScopeWithoutSuperClassConfig.class); |
73 | - | 73 | + |
74 | assertNotSame(config1, config2); | 74 | assertNotSame(config1, config2); |
75 | } | 75 | } |
76 | } | 76 | } |
impl/core/src/test/resources/configuration/prefix/demoiselle.properties
@@ -33,5 +33,6 @@ | @@ -33,5 +33,6 @@ | ||
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 | -prefix.prefixedAttribute=Atributo com prefixo | ||
37 | -prefixedAttribute=Sem prefixo | 36 | +prefix.prefixedAttribute=with prefix |
37 | +prefixedAttribute=without prefix | ||
38 | +endingWithDot.prefixedAttribute=prefix ending with dot |