Commit 13e7dae8745576b82b9e7ae5815c89bf74efcc15

Authored by Cleverson Sacramento
2 parents 2b87ca2f 49c24614
Exists in master

Merge branch '2.3' of https://github.com/demoiselle/framework.git into 2.3

impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/ConfigurationLoader.java
@@ -82,7 +82,7 @@ public class ConfigurationLoader implements Serializable { @@ -82,7 +82,7 @@ public class ConfigurationLoader implements Serializable {
82 private static ResourceBundle bundle; 82 private static ResourceBundle bundle;
83 83
84 private static Logger logger; 84 private static Logger logger;
85 - 85 +
86 /** 86 /**
87 * Loads a config class filling it with the corresponding values. 87 * Loads a config class filling it with the corresponding values.
88 * 88 *
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/producer/ResourceBundleProducer.java
@@ -76,14 +76,7 @@ public class ResourceBundleProducer implements Serializable { @@ -76,14 +76,7 @@ public class ResourceBundleProducer implements Serializable {
76 */ 76 */
77 public static ResourceBundle create(String baseName, Locale locale) { 77 public static ResourceBundle create(String baseName, Locale locale) {
78 ResourceBundle bundle = null; 78 ResourceBundle bundle = null;
79 -  
80 - try {  
81 - bundle = new ResourceBundle(baseName, locale);  
82 -  
83 - } catch (MissingResourceException e) {  
84 - throw new DemoiselleException("File " + baseName + " not found!");  
85 - }  
86 - 79 + bundle = new ResourceBundle(baseName, locale);
87 return bundle; 80 return bundle;
88 } 81 }
89 82
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/ConfigurationLoaderTest.java
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.internal.configuration;  
38 -//  
39 -//import static org.easymock.EasyMock.expect;  
40 -//import static org.junit.Assert.assertEquals;  
41 -//import static org.junit.Assert.assertNull;  
42 -//import static org.junit.Assert.assertTrue;  
43 -//import static org.junit.Assert.fail;  
44 -//import static org.powermock.api.easymock.PowerMock.mockStatic;  
45 -//  
46 -//import javax.validation.constraints.NotNull;  
47 -//  
48 -//import org.junit.After;  
49 -//import org.junit.Before;  
50 -//import org.junit.Test;  
51 -//import org.junit.runner.RunWith;  
52 -//import org.powermock.api.easymock.PowerMock;  
53 -//import org.powermock.core.classloader.annotations.PrepareForTest;  
54 -//import org.powermock.modules.junit4.PowerMockRunner;  
55 -//import org.powermock.reflect.Whitebox;  
56 -//import org.slf4j.Logger;  
57 -//  
58 -//import br.gov.frameworkdemoiselle.annotation.Ignore;  
59 -//import br.gov.frameworkdemoiselle.annotation.Name;  
60 -//import br.gov.frameworkdemoiselle.configuration.ConfigType;  
61 -//import br.gov.frameworkdemoiselle.configuration.Configuration;  
62 -//import br.gov.frameworkdemoiselle.configuration.ConfigurationException;  
63 -//import br.gov.frameworkdemoiselle.internal.bootstrap.CoreBootstrap;  
64 -//import br.gov.frameworkdemoiselle.util.ResourceBundle;  
65 -//  
66 -//@RunWith(PowerMockRunner.class)  
67 -//@PrepareForTest(CoreBootstrap.class)  
68 -//public class ConfigurationLoaderTest {  
69 -//  
70 -// private ConfigurationLoader configurationLoader;  
71 -//  
72 -// @Configuration  
73 -// public class ConfigurationSuccessfulProperties {  
74 -//  
75 -// @Name("frameworkdemoiselle.configurationtest.nameConfiguration")  
76 -// protected String nameConfiguration;  
77 -//  
78 -// }  
79 -//  
80 -// @Configuration  
81 -// public class ConfigurationSuccessfulProperties2 {  
82 -//  
83 -// @Name("frameworkdemoiselle.configurationtest.name")  
84 -// protected String name;  
85 -//  
86 -// }  
87 -//  
88 -// @Configuration(resource = "absentFile")  
89 -// public class ConfigurationPropertiesWithAbsentFile {  
90 -//  
91 -// @Name("frameworkdemoiselle.configurationtest.nameConfiguration")  
92 -// protected String nameConfiguration;  
93 -//  
94 -// }  
95 -//  
96 -// @Configuration  
97 -// public class ConfigurationWithEmptyName {  
98 -//  
99 -// @Name("")  
100 -// protected String nameConfiguration;  
101 -//  
102 -// }  
103 -//  
104 -// @Configuration  
105 -// public class ConfigurationWithoutNameAnnotation {  
106 -//  
107 -// protected String nameConfiguration;  
108 -//  
109 -// }  
110 -//  
111 -// @Configuration  
112 -// public class ConfigurationWithIgnoreAnnotation {  
113 -//  
114 -// @Ignore  
115 -// protected String nameConfiguration;  
116 -//  
117 -// }  
118 -//  
119 -// @Configuration(prefix = "frameworkdemoiselle.configurationtest")  
120 -// public class ConfigurationWithPrefix {  
121 -//  
122 -// @Name("nameConfiguration")  
123 -// protected String nameConfiguration;  
124 -//  
125 -// }  
126 -//  
127 -// @Configuration  
128 -// public class ConfigurationWithKeyNotFoundInProperties {  
129 -//  
130 -// protected Integer notExistKey;  
131 -// }  
132 -//  
133 -// @Configuration  
134 -// public class ConfigurationWithNotNullFieldButValueIsNull {  
135 -//  
136 -// @Name("notexistKey")  
137 -// @NotNull  
138 -// protected int nameConfiguration;  
139 -//  
140 -// }  
141 -//  
142 -// @Configuration  
143 -// public class ConfigurationWithNotNullFieldAndValueIsNotNull {  
144 -//  
145 -// @Name("nameConfiguration")  
146 -// @NotNull  
147 -// protected String nameConfiguration;  
148 -//  
149 -// }  
150 -//  
151 -// @Configuration  
152 -// public class ConfigurationWithNonPrimitiveFieldValueNull {  
153 -//  
154 -// @Name("notexistKey")  
155 -// protected String nameConfiguration;  
156 -//  
157 -// }  
158 -//  
159 -// @Configuration  
160 -// public class ConfigurationWithPrimitiveFieldValueNull {  
161 -//  
162 -// @Name("notexistKey")  
163 -// protected int nameConfiguration = 1;  
164 -//  
165 -// }  
166 -//  
167 -// @Configuration(type = ConfigType.SYSTEM)  
168 -// public class ConfigurationWithKeyFromSystem {  
169 -//  
170 -// @Name("os.name")  
171 -// protected String nameConfiguration;  
172 -//  
173 -// }  
174 -//  
175 -// @Configuration(type = ConfigType.XML)  
176 -// public class ConfigurationWithKeyFromXML {  
177 -//  
178 -// @Name("nameConfiguration")  
179 -// protected String nameConfiguration;  
180 -//  
181 -// }  
182 -//  
183 -// @Configuration(type = ConfigType.XML, prefix = "br.gov.frameworkdemoiselle")  
184 -// public class ConfigurationFromXMLWithPrefix {  
185 -//  
186 -// @Name("nameConfiguration")  
187 -// protected String nameConfiguration;  
188 -//  
189 -// }  
190 -//  
191 -// @Configuration  
192 -// public class ConfigurationPropertiesWithTwoAmbiguousKey {  
193 -//  
194 -// protected String twoConfiguration;  
195 -//  
196 -// }  
197 -//  
198 -// @Configuration  
199 -// public class ConfigurationPropertiesWithThreeAmbiguousKey {  
200 -//  
201 -// protected String threeConfiguration;  
202 -//  
203 -// }  
204 -//  
205 -// @Configuration  
206 -// public class ConfigurationPropertiesWithFourAmbiguousKey {  
207 -//  
208 -// protected String fourConfiguration;  
209 -//  
210 -// }  
211 -//  
212 -// @Configuration  
213 -// public class ConfigurationWithConventionUnderline {  
214 -//  
215 -// protected String conventionUnderline;  
216 -//  
217 -// }  
218 -//  
219 -// @Configuration(type = ConfigType.XML)  
220 -// public class ConfigurationXMLWithConventionUnderline {  
221 -//  
222 -// protected String conventionUnderline;  
223 -//  
224 -// }  
225 -//  
226 -// @Configuration  
227 -// public class ConfigurationWithConventionDot {  
228 -//  
229 -// protected String conventionDot;  
230 -//  
231 -// }  
232 -//  
233 -// @Configuration(type = ConfigType.XML)  
234 -// public class ConfigurationXMLWithConventionDot {  
235 -//  
236 -// protected String conventionDot;  
237 -//  
238 -// }  
239 -//  
240 -// @Configuration  
241 -// public class ConfigurationWithConventionAllUpperCase {  
242 -//  
243 -// protected String conventionAllUpperCase;  
244 -//  
245 -// }  
246 -//  
247 -// @Configuration(type = ConfigType.XML)  
248 -// public class ConfigurationXMLWithConventionAllUpperCase {  
249 -//  
250 -// protected String conventionAllUpperCase;  
251 -//  
252 -// }  
253 -//  
254 -// @Configuration  
255 -// public class ConfigurationWithConventionAllLowerCase {  
256 -//  
257 -// protected String conventionAllLowerCase;  
258 -//  
259 -// }  
260 -//  
261 -// @Configuration(type = ConfigType.XML)  
262 -// public class ConfigurationXMLWithConventionAllLowerCase {  
263 -//  
264 -// protected String conventionAllLowerCase;  
265 -//  
266 -// }  
267 -//  
268 -// @Configuration(prefix = "br.gov.frameworkdemoiselle")  
269 -// public class ConfigurationPropertiesSuccessWithPrefixNonAmbiguous {  
270 -//  
271 -// protected String success;  
272 -//  
273 -// }  
274 -//  
275 -// @Configuration  
276 -// public class ConfigurationPropertiesErrorWithComplexObject {  
277 -//  
278 -// protected ConfigurationWithConventionAllLowerCase complexObject;  
279 -// }  
280 -//  
281 -// @Before  
282 -// public void setUp() throws Exception {  
283 -// Logger logger;  
284 -// ResourceBundle bundle;  
285 -// logger = PowerMock.createMock(Logger.class);  
286 -// bundle = new ResourceBundle(ResourceBundle.getBundle("demoiselle-core-bundle"));  
287 -// configurationLoader = new ConfigurationLoader();  
288 -// Whitebox.setInternalState(this.configurationLoader, "bundle", bundle);  
289 -// Whitebox.setInternalState(this.configurationLoader, "logger", logger);  
290 -// }  
291 -//  
292 -// @After  
293 -// public void tearDown() throws Exception {  
294 -// }  
295 -//  
296 -// @Test  
297 -// public void testConfigurationSuccessfulPropertiesPossibleConventions() {  
298 -// ConfigurationSuccessfulProperties config = new ConfigurationSuccessfulProperties();  
299 -//  
300 -// mockStatic(CoreBootstrap.class);  
301 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
302 -// PowerMock.replay(CoreBootstrap.class);  
303 -//  
304 -// configurationLoader.load(config);  
305 -// assertEquals("ConfigurationTest", config.nameConfiguration);  
306 -//  
307 -// }  
308 -//  
309 -// @Test  
310 -// public void testConfigurationSuccessfulPropertiesNoConventions() {  
311 -// ConfigurationSuccessfulProperties2 config = new ConfigurationSuccessfulProperties2();  
312 -//  
313 -// mockStatic(CoreBootstrap.class);  
314 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
315 -// PowerMock.replay(CoreBootstrap.class);  
316 -//  
317 -// configurationLoader.load(config);  
318 -// assertEquals("ConfigurationTest2", config.name);  
319 -// }  
320 -//  
321 -// @Test  
322 -// public void ConfigurationPropertiesWithAbsentFile() {  
323 -// ConfigurationPropertiesWithAbsentFile config = new ConfigurationPropertiesWithAbsentFile();  
324 -//  
325 -// mockStatic(CoreBootstrap.class);  
326 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
327 -// PowerMock.replay(CoreBootstrap.class);  
328 -//  
329 -// try {  
330 -// configurationLoader.load(config);  
331 -// fail();  
332 -// } catch (Exception e) {  
333 -// }  
334 -// }  
335 -//  
336 -// @Test  
337 -// public void testConfigurationProcessorWithNameEmpty() {  
338 -// ConfigurationWithEmptyName config = new ConfigurationWithEmptyName();  
339 -//  
340 -// mockStatic(CoreBootstrap.class);  
341 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
342 -// PowerMock.replay(CoreBootstrap.class);  
343 -//  
344 -// try {  
345 -// configurationLoader.load(config);  
346 -// fail();  
347 -// } catch (Exception e) {  
348 -// }  
349 -// }  
350 -//  
351 -// @Test  
352 -// public void testConfigurationWithoutNameAnnotation() {  
353 -// ConfigurationWithoutNameAnnotation config = new ConfigurationWithoutNameAnnotation();  
354 -//  
355 -// mockStatic(CoreBootstrap.class);  
356 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
357 -// PowerMock.replay(CoreBootstrap.class);  
358 -//  
359 -// configurationLoader.load(config);  
360 -// assertEquals("ConfigurationTest", config.nameConfiguration);  
361 -// }  
362 -//  
363 -// @Test  
364 -// public void testConfigurationWithIgnoreAnnotation() {  
365 -// ConfigurationWithIgnoreAnnotation config = new ConfigurationWithIgnoreAnnotation();  
366 -//  
367 -// configurationLoader.load(config);  
368 -// assertNull(config.nameConfiguration);  
369 -// }  
370 -//  
371 -// @Test  
372 -// public void testConfigurationWithPrefix() {  
373 -// ConfigurationWithPrefix config = new ConfigurationWithPrefix();  
374 -//  
375 -// mockStatic(CoreBootstrap.class);  
376 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
377 -// PowerMock.replay(CoreBootstrap.class);  
378 -//  
379 -// configurationLoader.load(config);  
380 -// assertEquals("ConfigurationTest", config.nameConfiguration);  
381 -// }  
382 -//  
383 -// @Test  
384 -// public void testConfigurationWithKeyNotFoundInProperties() {  
385 -// ConfigurationWithKeyNotFoundInProperties config = new ConfigurationWithKeyNotFoundInProperties();  
386 -//  
387 -// configurationLoader.load(config);  
388 -// assertNull(config.notExistKey);  
389 -// }  
390 -//  
391 -// @Test  
392 -// public void testConfigurationWithNotNullFieldButValueIsNull() {  
393 -// ConfigurationWithNotNullFieldButValueIsNull config = new ConfigurationWithNotNullFieldButValueIsNull();  
394 -//  
395 -// mockStatic(CoreBootstrap.class);  
396 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
397 -// PowerMock.replay(CoreBootstrap.class);  
398 -//  
399 -// try {  
400 -// configurationLoader.load(config);  
401 -// fail();  
402 -// } catch (Exception e) {  
403 -// assertTrue(true);  
404 -// }  
405 -// }  
406 -//  
407 -// @Test  
408 -// public void testConfigurationWithNotNullFieldAndValueIsNotNull() {  
409 -// ConfigurationWithNotNullFieldAndValueIsNotNull config = new ConfigurationWithNotNullFieldAndValueIsNotNull();  
410 -//  
411 -// mockStatic(CoreBootstrap.class);  
412 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
413 -// PowerMock.replay(CoreBootstrap.class);  
414 -//  
415 -// configurationLoader.load(config);  
416 -// assertEquals("ConfigurationTest", config.nameConfiguration);  
417 -// }  
418 -//  
419 -// @Test  
420 -// public void testConfigurationWithNonPrimitiveFieldValueNull() {  
421 -// ConfigurationWithNonPrimitiveFieldValueNull config = new ConfigurationWithNonPrimitiveFieldValueNull();  
422 -//  
423 -// configurationLoader.load(config);  
424 -// assertNull(config.nameConfiguration);  
425 -// }  
426 -//  
427 -// @Test  
428 -// public void testConfigurationWithPrimitiveFieldValueNull() {  
429 -// ConfigurationWithPrimitiveFieldValueNull config = new ConfigurationWithPrimitiveFieldValueNull();  
430 -//  
431 -// configurationLoader.load(config);  
432 -// assertEquals(1, config.nameConfiguration);  
433 -// }  
434 -//  
435 -// @Test  
436 -// public void testConfigurationWithKeyFromSystem() {  
437 -// ConfigurationWithKeyFromSystem config = new ConfigurationWithKeyFromSystem();  
438 -//  
439 -// mockStatic(CoreBootstrap.class);  
440 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
441 -// PowerMock.replay(CoreBootstrap.class);  
442 -//  
443 -// configurationLoader.load(config);  
444 -// assertEquals(System.getProperty("os.name"), config.nameConfiguration);  
445 -// }  
446 -//  
447 -// @Test  
448 -// public void testConfigurationWithKeyFromXML() {  
449 -// ConfigurationWithKeyFromXML config = new ConfigurationWithKeyFromXML();  
450 -//  
451 -// mockStatic(CoreBootstrap.class);  
452 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
453 -// PowerMock.replay(CoreBootstrap.class);  
454 -//  
455 -// configurationLoader.load(config);  
456 -// assertEquals("ConfigurationTest", config.nameConfiguration);  
457 -// }  
458 -//  
459 -// @Test  
460 -// public void testConfigurationWithTwoAmbiguousKey() {  
461 -// ConfigurationPropertiesWithTwoAmbiguousKey config = new ConfigurationPropertiesWithTwoAmbiguousKey();  
462 -//  
463 -// mockStatic(CoreBootstrap.class);  
464 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
465 -// PowerMock.replay(CoreBootstrap.class);  
466 -//  
467 -// try {  
468 -// configurationLoader.load(config);  
469 -// fail();  
470 -// } catch (Exception e) {  
471 -// assertTrue(e instanceof ConfigurationException);  
472 -// }  
473 -//  
474 -// }  
475 -//  
476 -// @Test  
477 -// public void testConfigurationWithThreeAmbiguousKey() {  
478 -// ConfigurationPropertiesWithThreeAmbiguousKey config = new ConfigurationPropertiesWithThreeAmbiguousKey();  
479 -//  
480 -// mockStatic(CoreBootstrap.class);  
481 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
482 -// PowerMock.replay(CoreBootstrap.class);  
483 -//  
484 -// try {  
485 -// configurationLoader.load(config);  
486 -// fail();  
487 -// } catch (Exception e) {  
488 -// assertTrue(e instanceof ConfigurationException);  
489 -// }  
490 -//  
491 -// }  
492 -//  
493 -// @Test  
494 -// public void testConfigurationWithFourAmbiguousKey() {  
495 -// ConfigurationPropertiesWithFourAmbiguousKey config = new ConfigurationPropertiesWithFourAmbiguousKey();  
496 -//  
497 -// mockStatic(CoreBootstrap.class);  
498 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
499 -// PowerMock.replay(CoreBootstrap.class);  
500 -//  
501 -// try {  
502 -// configurationLoader.load(config);  
503 -// fail();  
504 -// } catch (Exception e) {  
505 -// assertTrue(e instanceof ConfigurationException);  
506 -// }  
507 -//  
508 -// }  
509 -//  
510 -// @Test  
511 -// public void testConfigurationWithPrefixNotAmbiguous() {  
512 -// ConfigurationPropertiesSuccessWithPrefixNonAmbiguous config = new ConfigurationPropertiesSuccessWithPrefixNonAmbiguous();  
513 -//  
514 -// mockStatic(CoreBootstrap.class);  
515 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
516 -// PowerMock.replay(CoreBootstrap.class);  
517 -//  
518 -// configurationLoader.load(config);  
519 -// assertEquals("Success", config.success);  
520 -// }  
521 -//  
522 -// @Test  
523 -// public void testConfigurationWithConventionUnderline() {  
524 -// ConfigurationWithConventionUnderline config = new ConfigurationWithConventionUnderline();  
525 -//  
526 -// mockStatic(CoreBootstrap.class);  
527 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
528 -// PowerMock.replay(CoreBootstrap.class);  
529 -//  
530 -// configurationLoader.load(config);  
531 -// assertEquals("Convention Underline", config.conventionUnderline);  
532 -// }  
533 -//  
534 -// @Test  
535 -// public void testConfigurationWithConventionDot() {  
536 -// ConfigurationWithConventionDot config = new ConfigurationWithConventionDot();  
537 -//  
538 -// mockStatic(CoreBootstrap.class);  
539 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
540 -// PowerMock.replay(CoreBootstrap.class);  
541 -//  
542 -// configurationLoader.load(config);  
543 -// assertEquals("Convention Dot", config.conventionDot);  
544 -// }  
545 -//  
546 -// @Test  
547 -// public void testConfigurationWithConventionAllLowerCase() {  
548 -// ConfigurationWithConventionAllLowerCase config = new ConfigurationWithConventionAllLowerCase();  
549 -//  
550 -// mockStatic(CoreBootstrap.class);  
551 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
552 -// PowerMock.replay(CoreBootstrap.class);  
553 -//  
554 -// configurationLoader.load(config);  
555 -// assertEquals("All LowerCase", config.conventionAllLowerCase);  
556 -// }  
557 -//  
558 -// @Test  
559 -// public void testConfigurationWithConventionAllUpperCase() {  
560 -// ConfigurationWithConventionAllUpperCase config = new ConfigurationWithConventionAllUpperCase();  
561 -//  
562 -// mockStatic(CoreBootstrap.class);  
563 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
564 -// PowerMock.replay(CoreBootstrap.class);  
565 -//  
566 -// configurationLoader.load(config);  
567 -// assertEquals("ALL UPPERCASE", config.conventionAllUpperCase);  
568 -// }  
569 -//  
570 -// @Test  
571 -// public void testConfigurationPropertiesErrorWithComplexObject() {  
572 -// ConfigurationPropertiesErrorWithComplexObject config = new ConfigurationPropertiesErrorWithComplexObject();  
573 -//  
574 -// try {  
575 -// configurationLoader.load(config);  
576 -// fail();  
577 -// } catch (Throwable throwable) {  
578 -// }  
579 -// }  
580 -//  
581 -// @Test  
582 -// public void testConfigurationFromXMLWithPrefix() {  
583 -// ConfigurationFromXMLWithPrefix config = new ConfigurationFromXMLWithPrefix();  
584 -//  
585 -// mockStatic(CoreBootstrap.class);  
586 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
587 -// PowerMock.replay(CoreBootstrap.class);  
588 -//  
589 -// configurationLoader.load(config);  
590 -// assertEquals("ConfigurationTest", config.nameConfiguration);  
591 -// }  
592 -//  
593 -// @Test  
594 -// public void testConfigurationXMLWithConventionDot() {  
595 -// ConfigurationXMLWithConventionDot config = new ConfigurationXMLWithConventionDot();  
596 -//  
597 -// mockStatic(CoreBootstrap.class);  
598 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
599 -// PowerMock.replay(CoreBootstrap.class);  
600 -//  
601 -// configurationLoader.load(config);  
602 -// assertEquals("convention.dot", config.conventionDot);  
603 -// }  
604 -//  
605 -// @Test  
606 -// public void testConfigurationXMLWithConventionUnderline() {  
607 -// ConfigurationXMLWithConventionUnderline config = new ConfigurationXMLWithConventionUnderline();  
608 -//  
609 -// mockStatic(CoreBootstrap.class);  
610 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
611 -// PowerMock.replay(CoreBootstrap.class);  
612 -//  
613 -// configurationLoader.load(config);  
614 -// assertEquals("Convention_Underline", config.conventionUnderline);  
615 -// }  
616 -//  
617 -// @Test  
618 -// public void testConfigurationXMLWithConventionAllUpperCase() {  
619 -// ConfigurationXMLWithConventionAllUpperCase config = new ConfigurationXMLWithConventionAllUpperCase();  
620 -//  
621 -// mockStatic(CoreBootstrap.class);  
622 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
623 -// PowerMock.replay(CoreBootstrap.class);  
624 -//  
625 -// configurationLoader.load(config);  
626 -// assertEquals("ALL UPPERCASE", config.conventionAllUpperCase);  
627 -// }  
628 -//  
629 -// @Test  
630 -// public void testConfigurationXMLWithConventionAllLowerCase() {  
631 -// ConfigurationXMLWithConventionAllLowerCase config = new ConfigurationXMLWithConventionAllLowerCase();  
632 -//  
633 -// mockStatic(CoreBootstrap.class);  
634 -// expect(CoreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);  
635 -// PowerMock.replay(CoreBootstrap.class);  
636 -//  
637 -// configurationLoader.load(config);  
638 -// assertEquals("All LowerCase", config.conventionAllLowerCase);  
639 -// }  
640 -//  
641 -//}  
642 \ No newline at end of file 1 \ No newline at end of file
  2 +/*
  3 + * Demoiselle Framework
  4 + * Copyright (C) 2010 SERPRO
  5 + * ----------------------------------------------------------------------------
  6 + * This file is part of Demoiselle Framework.
  7 + *
  8 + * Demoiselle Framework is free software; you can redistribute it and/or
  9 + * modify it under the terms of the GNU Lesser General Public License version 3
  10 + * as published by the Free Software Foundation.
  11 + *
  12 + * This program is distributed in the hope that it will be useful,
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15 + * GNU General Public License for more details.
  16 + *
  17 + * You should have received a copy of the GNU Lesser General Public License version 3
  18 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  19 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  20 + * Fifth Floor, Boston, MA 02110-1301, USA.
  21 + * ----------------------------------------------------------------------------
  22 + * Este arquivo é parte do Framework Demoiselle.
  23 + *
  24 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  25 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  26 + * do Software Livre (FSF).
  27 + *
  28 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  29 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  30 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  31 + * para maiores detalhes.
  32 + *
  33 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  34 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  35 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  36 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  37 + */
  38 +package br.gov.frameworkdemoiselle.internal.configuration;
  39 +
  40 +import static org.easymock.EasyMock.expect;
  41 +import static org.junit.Assert.assertEquals;
  42 +import static org.junit.Assert.assertNull;
  43 +import static org.junit.Assert.assertTrue;
  44 +import static org.junit.Assert.fail;
  45 +import static org.powermock.api.easymock.PowerMock.mockStatic;
  46 +
  47 +import java.util.Locale;
  48 +import java.util.Properties;
  49 +
  50 +import javax.validation.constraints.NotNull;
  51 +
  52 +import org.junit.After;
  53 +import org.junit.Before;
  54 +import org.junit.Test;
  55 +import org.junit.runner.RunWith;
  56 +import org.powermock.api.easymock.PowerMock;
  57 +import org.powermock.core.classloader.annotations.PrepareForTest;
  58 +import org.powermock.modules.junit4.PowerMockRunner;
  59 +
  60 +import br.gov.frameworkdemoiselle.annotation.Ignore;
  61 +import br.gov.frameworkdemoiselle.annotation.Name;
  62 +import br.gov.frameworkdemoiselle.configuration.ConfigType;
  63 +import br.gov.frameworkdemoiselle.configuration.Configuration;
  64 +import br.gov.frameworkdemoiselle.configuration.ConfigurationException;
  65 +import br.gov.frameworkdemoiselle.internal.bootstrap.CoreBootstrap;
  66 +import br.gov.frameworkdemoiselle.util.Beans;
  67 +
  68 +@RunWith(PowerMockRunner.class)
  69 +@PrepareForTest(Beans.class)
  70 +public class ConfigurationLoaderTest {
  71 +
  72 + private ConfigurationLoader configurationLoader;
  73 +
  74 + private CoreBootstrap coreBootstrap;
  75 +
  76 + @Configuration
  77 + public class ConfigurationSuccessfulPropertiesWithClassField {
  78 +
  79 + protected Class classe;
  80 +
  81 + }
  82 +
  83 + @Configuration
  84 + public class ConfigurationSuccessfulPropertiesWithPropertiesField {
  85 +
  86 + protected Properties properties;
  87 +
  88 + }
  89 +
  90 + @Configuration
  91 + public class ConfigurationSuccessfulProperties {
  92 +
  93 + @Name("frameworkdemoiselle.configurationtest.nameConfiguration")
  94 + protected String nameConfiguration;
  95 +
  96 + }
  97 +
  98 + @Configuration
  99 + public class ConfigurationSuccessfulProperties2 {
  100 +
  101 + @Name("frameworkdemoiselle.configurationtest.name")
  102 + protected String name;
  103 +
  104 + }
  105 +
  106 + @Configuration(resource = "absentFile")
  107 + public class ConfigurationPropertiesWithAbsentFile {
  108 +
  109 + @Name("frameworkdemoiselle.configurationtest.nameConfiguration")
  110 + protected String nameConfiguration;
  111 +
  112 + }
  113 +
  114 + @Configuration
  115 + public class ConfigurationWithEmptyName {
  116 +
  117 + @Name("")
  118 + protected String nameConfiguration;
  119 +
  120 + }
  121 +
  122 + @Configuration
  123 + public class ConfigurationWithoutNameAnnotation {
  124 +
  125 + protected String nameConfiguration;
  126 +
  127 + }
  128 +
  129 + @Configuration
  130 + public class ConfigurationWithIgnoreAnnotation {
  131 +
  132 + @Ignore
  133 + protected String nameConfiguration;
  134 +
  135 + }
  136 +
  137 + @Configuration(prefix = "frameworkdemoiselle.configurationtest")
  138 + public class ConfigurationWithPrefix {
  139 +
  140 + @Name("nameConfiguration")
  141 + protected String nameConfiguration;
  142 +
  143 + }
  144 +
  145 + @Configuration
  146 + public class ConfigurationWithKeyNotFoundInProperties {
  147 +
  148 + protected Integer notExistKey;
  149 + }
  150 +
  151 + @Configuration
  152 + public class ConfigurationWithNotNullFieldButValueIsNull {
  153 +
  154 + @Name("notexistKey")
  155 + @NotNull
  156 + protected int nameConfiguration;
  157 +
  158 + }
  159 +
  160 + @Configuration
  161 + public class ConfigurationWithNotNullFieldAndValueIsNotNull {
  162 +
  163 + @Name("nameConfiguration")
  164 + @NotNull
  165 + protected String nameConfiguration;
  166 +
  167 + }
  168 +
  169 + @Configuration
  170 + public class ConfigurationWithNonPrimitiveFieldValueNull {
  171 +
  172 + @Name("notexistKey")
  173 + protected String nameConfiguration;
  174 +
  175 + }
  176 +
  177 + @Configuration
  178 + public class ConfigurationWithPrimitiveFieldValueNull {
  179 +
  180 + @Name("notexistKey")
  181 + protected int nameConfiguration = 1;
  182 +
  183 + }
  184 +
  185 + @Configuration(type = ConfigType.SYSTEM)
  186 + public class ConfigurationWithKeyFromSystem {
  187 +
  188 + @Name("os.name")
  189 + protected String nameConfiguration;
  190 +
  191 + }
  192 +
  193 + @Configuration(type = ConfigType.XML)
  194 + public class ConfigurationWithKeyFromXML {
  195 +
  196 + @Name("nameConfiguration")
  197 + protected String nameConfiguration;
  198 +
  199 + }
  200 +
  201 + @Configuration(type = ConfigType.XML, prefix = "br.gov.frameworkdemoiselle")
  202 + public class ConfigurationFromXMLWithPrefix {
  203 +
  204 + @Name("nameConfiguration")
  205 + protected String nameConfiguration;
  206 +
  207 + }
  208 +
  209 + @Configuration
  210 + public class ConfigurationPropertiesWithTwoAmbiguousKey {
  211 +
  212 + protected String twoConfiguration;
  213 +
  214 + }
  215 +
  216 + @Configuration
  217 + public class ConfigurationPropertiesWithThreeAmbiguousKey {
  218 +
  219 + protected String threeConfiguration;
  220 +
  221 + }
  222 +
  223 + @Configuration
  224 + public class ConfigurationPropertiesWithFourAmbiguousKey {
  225 +
  226 + protected String fourConfiguration;
  227 +
  228 + }
  229 +
  230 + @Configuration
  231 + public class ConfigurationWithConventionUnderline {
  232 +
  233 + protected String conventionUnderline;
  234 +
  235 + }
  236 +
  237 + @Configuration(type = ConfigType.XML)
  238 + public class ConfigurationXMLWithConventionUnderline {
  239 +
  240 + protected String conventionUnderline;
  241 +
  242 + }
  243 +
  244 + @Configuration
  245 + public class ConfigurationWithConventionDot {
  246 +
  247 + protected String conventionDot;
  248 +
  249 + }
  250 +
  251 + @Configuration(type = ConfigType.XML)
  252 + public class ConfigurationXMLWithConventionDot {
  253 +
  254 + protected String conventionDot;
  255 +
  256 + }
  257 +
  258 + @Configuration
  259 + public class ConfigurationWithConventionAllUpperCase {
  260 +
  261 + protected String conventionAllUpperCase;
  262 +
  263 + }
  264 +
  265 + @Configuration(type = ConfigType.XML)
  266 + public class ConfigurationXMLWithConventionAllUpperCase {
  267 +
  268 + protected String conventionAllUpperCase;
  269 +
  270 + }
  271 +
  272 + @Configuration
  273 + public class ConfigurationWithConventionAllLowerCase {
  274 +
  275 + protected String conventionAllLowerCase;
  276 +
  277 + }
  278 +
  279 + @Configuration(type = ConfigType.XML)
  280 + public class ConfigurationXMLWithConventionAllLowerCase {
  281 +
  282 + protected String conventionAllLowerCase;
  283 +
  284 + }
  285 +
  286 + @Configuration(prefix = "br.gov.frameworkdemoiselle")
  287 + public class ConfigurationPropertiesSuccessWithPrefixNonAmbiguous {
  288 +
  289 + protected String success;
  290 +
  291 + }
  292 +
  293 + @Configuration
  294 + public class ConfigurationPropertiesErrorWithComplexObject {
  295 +
  296 + protected ConfigurationWithConventionAllLowerCase complexObject;
  297 + }
  298 +
  299 + @Before
  300 + public void setUp() throws Exception {
  301 + this.configurationLoader = new ConfigurationLoader();
  302 + mockStatic(Beans.class);
  303 + this.coreBootstrap = PowerMock.createMock(CoreBootstrap.class);
  304 +
  305 + expect(Beans.getReference(CoreBootstrap.class)).andReturn(coreBootstrap);
  306 + expect(Beans.getReference(Locale.class)).andReturn(Locale.getDefault());
  307 + }
  308 +
  309 + @After
  310 + public void tearDown() throws Exception {
  311 + }
  312 +
  313 + @Test
  314 + public void testConfigurationSuccessfulPropertiesWithClassField() {
  315 + ConfigurationSuccessfulPropertiesWithClassField config = new ConfigurationSuccessfulPropertiesWithClassField();
  316 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  317 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  318 + configurationLoader.load(config);
  319 + assertEquals(ConfigurationLoaderTest.class,config.classe);
  320 + }
  321 +
  322 + @Test
  323 + public void testConfigurationSuccessfulPropertiesWithPropertiesField() {
  324 + ConfigurationSuccessfulPropertiesWithPropertiesField config = new ConfigurationSuccessfulPropertiesWithPropertiesField();
  325 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  326 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  327 + configurationLoader.load(config);
  328 + assertEquals("teste1",config.properties.getProperty("1"));
  329 + assertEquals("teste2",config.properties.getProperty("2"));
  330 + assertTrue(config.properties.containsKey("1"));
  331 + assertTrue(config.properties.containsKey("2"));
  332 + }
  333 +
  334 + @Test
  335 + public void testConfigurationSuccessfulPropertiesPossibleConventions() {
  336 + ConfigurationSuccessfulProperties config = new ConfigurationSuccessfulProperties();
  337 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  338 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  339 + configurationLoader.load(config);
  340 + assertEquals("ConfigurationTest", config.nameConfiguration);
  341 +
  342 + }
  343 +
  344 + @Test
  345 + public void testConfigurationSuccessfulPropertiesNoConventions() {
  346 + ConfigurationSuccessfulProperties2 config = new ConfigurationSuccessfulProperties2();
  347 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  348 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  349 + configurationLoader.load(config);
  350 + assertEquals("ConfigurationTest2", config.name);
  351 + }
  352 +
  353 + @Test
  354 + public void ConfigurationPropertiesWithAbsentFile() {
  355 + ConfigurationPropertiesWithAbsentFile config = new ConfigurationPropertiesWithAbsentFile();
  356 +
  357 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  358 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  359 +
  360 + try {
  361 + configurationLoader.load(config);
  362 + fail();
  363 + } catch (Exception e) {
  364 + }
  365 + }
  366 +
  367 + @Test
  368 + public void testConfigurationProcessorWithNameEmpty() {
  369 + ConfigurationWithEmptyName config = new ConfigurationWithEmptyName();
  370 +
  371 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  372 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  373 +
  374 + try {
  375 + configurationLoader.load(config);
  376 + fail();
  377 + } catch (Exception e) {
  378 + }
  379 + }
  380 +
  381 + @Test
  382 + public void testConfigurationWithoutNameAnnotation() {
  383 + ConfigurationWithoutNameAnnotation config = new ConfigurationWithoutNameAnnotation();
  384 +
  385 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  386 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  387 +
  388 + configurationLoader.load(config);
  389 + assertEquals("ConfigurationTest", config.nameConfiguration);
  390 + }
  391 +
  392 + @Test
  393 + public void testConfigurationWithIgnoreAnnotation() {
  394 + ConfigurationWithIgnoreAnnotation config = new ConfigurationWithIgnoreAnnotation();
  395 +
  396 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  397 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  398 +
  399 + configurationLoader.load(config);
  400 + assertNull(config.nameConfiguration);
  401 + }
  402 +
  403 + @Test
  404 + public void testConfigurationWithPrefix() {
  405 + ConfigurationWithPrefix config = new ConfigurationWithPrefix();
  406 +
  407 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  408 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  409 +
  410 + configurationLoader.load(config);
  411 + assertEquals("ConfigurationTest", config.nameConfiguration);
  412 + }
  413 +
  414 + @Test
  415 + public void testConfigurationWithKeyNotFoundInProperties() {
  416 + ConfigurationWithKeyNotFoundInProperties config = new ConfigurationWithKeyNotFoundInProperties();
  417 +
  418 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  419 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  420 +
  421 + configurationLoader.load(config);
  422 + assertNull(config.notExistKey);
  423 + }
  424 +
  425 + @Test
  426 + public void testConfigurationWithNotNullFieldButValueIsNull() {
  427 + ConfigurationWithNotNullFieldButValueIsNull config = new ConfigurationWithNotNullFieldButValueIsNull();
  428 +
  429 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  430 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  431 +
  432 + try {
  433 + configurationLoader.load(config);
  434 + fail();
  435 + } catch (Exception e) {
  436 + assertTrue(true);
  437 + }
  438 + }
  439 +
  440 + @Test
  441 + public void testConfigurationWithNotNullFieldAndValueIsNotNull() {
  442 + ConfigurationWithNotNullFieldAndValueIsNotNull config = new ConfigurationWithNotNullFieldAndValueIsNotNull();
  443 +
  444 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  445 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  446 +
  447 + configurationLoader.load(config);
  448 + assertEquals("ConfigurationTest", config.nameConfiguration);
  449 + }
  450 +
  451 + @Test
  452 + public void testConfigurationWithNonPrimitiveFieldValueNull() {
  453 + ConfigurationWithNonPrimitiveFieldValueNull config = new ConfigurationWithNonPrimitiveFieldValueNull();
  454 +
  455 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  456 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  457 +
  458 + configurationLoader.load(config);
  459 + assertNull(config.nameConfiguration);
  460 + }
  461 +
  462 + @Test
  463 + public void testConfigurationWithPrimitiveFieldValueNull() {
  464 + ConfigurationWithPrimitiveFieldValueNull config = new ConfigurationWithPrimitiveFieldValueNull();
  465 +
  466 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  467 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  468 +
  469 + configurationLoader.load(config);
  470 + assertEquals(1, config.nameConfiguration);
  471 + }
  472 +
  473 + @Test
  474 + public void testConfigurationWithKeyFromSystem() {
  475 + ConfigurationWithKeyFromSystem config = new ConfigurationWithKeyFromSystem();
  476 +
  477 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  478 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  479 +
  480 + configurationLoader.load(config);
  481 + assertEquals(System.getProperty("os.name"), config.nameConfiguration);
  482 + }
  483 +
  484 + @Test
  485 + public void testConfigurationWithKeyFromXML() {
  486 + ConfigurationWithKeyFromXML config = new ConfigurationWithKeyFromXML();
  487 +
  488 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  489 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  490 +
  491 + configurationLoader.load(config);
  492 + assertEquals("ConfigurationTest", config.nameConfiguration);
  493 + }
  494 +
  495 + @Test
  496 + public void testConfigurationWithTwoAmbiguousKey() {
  497 + ConfigurationPropertiesWithTwoAmbiguousKey config = new ConfigurationPropertiesWithTwoAmbiguousKey();
  498 +
  499 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  500 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  501 +
  502 + try {
  503 + configurationLoader.load(config);
  504 + fail();
  505 + } catch (Exception e) {
  506 + assertTrue(e instanceof ConfigurationException);
  507 + }
  508 +
  509 + }
  510 +
  511 + @Test
  512 + public void testConfigurationWithThreeAmbiguousKey() {
  513 + ConfigurationPropertiesWithThreeAmbiguousKey config = new ConfigurationPropertiesWithThreeAmbiguousKey();
  514 +
  515 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  516 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  517 +
  518 + try {
  519 + configurationLoader.load(config);
  520 + fail();
  521 + } catch (Exception e) {
  522 + assertTrue(e instanceof ConfigurationException);
  523 + }
  524 +
  525 + }
  526 +
  527 + @Test
  528 + public void testConfigurationWithFourAmbiguousKey() {
  529 + ConfigurationPropertiesWithFourAmbiguousKey config = new ConfigurationPropertiesWithFourAmbiguousKey();
  530 +
  531 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  532 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  533 +
  534 + try {
  535 + configurationLoader.load(config);
  536 + fail();
  537 + } catch (Exception e) {
  538 + assertTrue(e instanceof ConfigurationException);
  539 + }
  540 +
  541 + }
  542 +
  543 + @Test
  544 + public void testConfigurationWithPrefixNotAmbiguous() {
  545 + ConfigurationPropertiesSuccessWithPrefixNonAmbiguous config = new ConfigurationPropertiesSuccessWithPrefixNonAmbiguous();
  546 +
  547 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  548 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  549 +
  550 + configurationLoader.load(config);
  551 + assertEquals("Success", config.success);
  552 + }
  553 +
  554 + @Test
  555 + public void testConfigurationWithConventionUnderline() {
  556 + ConfigurationWithConventionUnderline config = new ConfigurationWithConventionUnderline();
  557 +
  558 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  559 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  560 +
  561 + configurationLoader.load(config);
  562 + assertEquals("Convention Underline", config.conventionUnderline);
  563 + }
  564 +
  565 + @Test
  566 + public void testConfigurationWithConventionDot() {
  567 + ConfigurationWithConventionDot config = new ConfigurationWithConventionDot();
  568 +
  569 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  570 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  571 +
  572 + configurationLoader.load(config);
  573 + assertEquals("Convention Dot", config.conventionDot);
  574 + }
  575 +
  576 + @Test
  577 + public void testConfigurationWithConventionAllLowerCase() {
  578 + ConfigurationWithConventionAllLowerCase config = new ConfigurationWithConventionAllLowerCase();
  579 +
  580 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  581 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  582 +
  583 + configurationLoader.load(config);
  584 + assertEquals("All LowerCase", config.conventionAllLowerCase);
  585 + }
  586 +
  587 + @Test
  588 + public void testConfigurationWithConventionAllUpperCase() {
  589 + ConfigurationWithConventionAllUpperCase config = new ConfigurationWithConventionAllUpperCase();
  590 +
  591 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  592 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  593 +
  594 + configurationLoader.load(config);
  595 + assertEquals("ALL UPPERCASE", config.conventionAllUpperCase);
  596 + }
  597 +
  598 + @Test
  599 + public void testConfigurationPropertiesErrorWithComplexObject() {
  600 + ConfigurationPropertiesErrorWithComplexObject config = new ConfigurationPropertiesErrorWithComplexObject();
  601 +
  602 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  603 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  604 +
  605 + try {
  606 + configurationLoader.load(config);
  607 + fail();
  608 + } catch (Throwable throwable) {
  609 + }
  610 + }
  611 +
  612 + @Test
  613 + public void testConfigurationFromXMLWithPrefix() {
  614 + ConfigurationFromXMLWithPrefix config = new ConfigurationFromXMLWithPrefix();
  615 +
  616 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  617 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  618 +
  619 + configurationLoader.load(config);
  620 + assertEquals("ConfigurationTest", config.nameConfiguration);
  621 + }
  622 +
  623 + @Test
  624 + public void testConfigurationXMLWithConventionDot() {
  625 + ConfigurationXMLWithConventionDot config = new ConfigurationXMLWithConventionDot();
  626 +
  627 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  628 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  629 +
  630 + configurationLoader.load(config);
  631 + assertEquals("convention.dot", config.conventionDot);
  632 + }
  633 +
  634 + @Test
  635 + public void testConfigurationXMLWithConventionUnderline() {
  636 + ConfigurationXMLWithConventionUnderline config = new ConfigurationXMLWithConventionUnderline();
  637 +
  638 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  639 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  640 +
  641 + configurationLoader.load(config);
  642 + assertEquals("Convention_Underline", config.conventionUnderline);
  643 + }
  644 +
  645 + @Test
  646 + public void testConfigurationXMLWithConventionAllUpperCase() {
  647 + ConfigurationXMLWithConventionAllUpperCase config = new ConfigurationXMLWithConventionAllUpperCase();
  648 +
  649 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  650 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  651 +
  652 + configurationLoader.load(config);
  653 + assertEquals("ALL UPPERCASE", config.conventionAllUpperCase);
  654 + }
  655 +
  656 + @Test
  657 + public void testConfigurationXMLWithConventionAllLowerCase() {
  658 + ConfigurationXMLWithConventionAllLowerCase config = new ConfigurationXMLWithConventionAllLowerCase();
  659 +
  660 + expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
  661 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  662 +
  663 + configurationLoader.load(config);
  664 + assertEquals("All LowerCase", config.conventionAllLowerCase);
  665 + }
  666 +
  667 +}
643 \ No newline at end of file 668 \ No newline at end of file
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/ConfigurationLoaderWithArrayTest.java
@@ -36,10 +36,9 @@ @@ -36,10 +36,9 @@
36 */ 36 */
37 package br.gov.frameworkdemoiselle.internal.configuration; 37 package br.gov.frameworkdemoiselle.internal.configuration;
38 38
39 -import static org.easymock.EasyMock.createMock;  
40 import static org.easymock.EasyMock.expect; 39 import static org.easymock.EasyMock.expect;
41 import static org.junit.Assert.assertEquals; 40 import static org.junit.Assert.assertEquals;
42 -import static org.powermock.api.easymock.PowerMock.replay; 41 +import static org.powermock.api.easymock.PowerMock.mockStatic;
43 42
44 import java.awt.Color; 43 import java.awt.Color;
45 import java.math.BigDecimal; 44 import java.math.BigDecimal;
@@ -55,16 +54,16 @@ import org.junit.Before; @@ -55,16 +54,16 @@ import org.junit.Before;
55 import org.junit.Test; 54 import org.junit.Test;
56 import org.junit.runner.RunWith; 55 import org.junit.runner.RunWith;
57 import org.powermock.api.easymock.PowerMock; 56 import org.powermock.api.easymock.PowerMock;
  57 +import org.powermock.core.classloader.annotations.PrepareForTest;
58 import org.powermock.modules.junit4.PowerMockRunner; 58 import org.powermock.modules.junit4.PowerMockRunner;
59 -import org.powermock.reflect.Whitebox;  
60 -import org.slf4j.Logger;  
61 59
62 import br.gov.frameworkdemoiselle.configuration.ConfigType; 60 import br.gov.frameworkdemoiselle.configuration.ConfigType;
63 import br.gov.frameworkdemoiselle.configuration.Configuration; 61 import br.gov.frameworkdemoiselle.configuration.Configuration;
64 import br.gov.frameworkdemoiselle.internal.bootstrap.CoreBootstrap; 62 import br.gov.frameworkdemoiselle.internal.bootstrap.CoreBootstrap;
65 -import br.gov.frameworkdemoiselle.util.ResourceBundle; 63 +import br.gov.frameworkdemoiselle.util.Beans;
66 64
67 @RunWith(PowerMockRunner.class) 65 @RunWith(PowerMockRunner.class)
  66 +@PrepareForTest(Beans.class)
68 public class ConfigurationLoaderWithArrayTest { 67 public class ConfigurationLoaderWithArrayTest {
69 68
70 private ConfigurationLoader configurationLoader; 69 private ConfigurationLoader configurationLoader;
@@ -149,13 +148,7 @@ public class ConfigurationLoaderWithArrayTest { @@ -149,13 +148,7 @@ public class ConfigurationLoaderWithArrayTest {
149 148
150 @Before 149 @Before
151 public void setUp() throws Exception { 150 public void setUp() throws Exception {
152 - Logger logger;  
153 - ResourceBundle bundle;  
154 - logger = PowerMock.createMock(Logger.class);  
155 - bundle = new ResourceBundle("demoiselle-core-bundle", Locale.getDefault());  
156 configurationLoader = new ConfigurationLoader(); 151 configurationLoader = new ConfigurationLoader();
157 - Whitebox.setInternalState(this.configurationLoader, "bundle", bundle);  
158 - Whitebox.setInternalState(this.configurationLoader, "logger", logger);  
159 } 152 }
160 153
161 @After 154 @After
@@ -341,12 +334,16 @@ public class ConfigurationLoaderWithArrayTest { @@ -341,12 +334,16 @@ public class ConfigurationLoaderWithArrayTest {
341 } 334 }
342 335
343 private ConfigurationPropertiesWithArray prepareConfigurationPropertiesWithArray() { 336 private ConfigurationPropertiesWithArray prepareConfigurationPropertiesWithArray() {
  337 + mockStatic(Beans.class);
344 ConfigurationPropertiesWithArray config = new ConfigurationPropertiesWithArray(); 338 ConfigurationPropertiesWithArray config = new ConfigurationPropertiesWithArray();
345 -  
346 - CoreBootstrap coreBootstrap = createMock(CoreBootstrap.class); 339 + CoreBootstrap coreBootstrap = PowerMock.createMock(CoreBootstrap.class);
  340 +
  341 + expect(Beans.getReference(CoreBootstrap.class)).andReturn(coreBootstrap);
  342 + expect(Beans.getReference(Locale.class)).andReturn(Locale.getDefault());
  343 +
347 expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true); 344 expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
348 345
349 - replay(coreBootstrap); 346 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
350 347
351 configurationLoader.load(config); 348 configurationLoader.load(config);
352 return config; 349 return config;
@@ -531,13 +528,17 @@ public class ConfigurationLoaderWithArrayTest { @@ -531,13 +528,17 @@ public class ConfigurationLoaderWithArrayTest {
531 } 528 }
532 529
533 private ConfigurationXMLWithArray prepareConfigurationXMLWithArray() { 530 private ConfigurationXMLWithArray prepareConfigurationXMLWithArray() {
  531 + mockStatic(Beans.class);
534 ConfigurationXMLWithArray config = new ConfigurationXMLWithArray(); 532 ConfigurationXMLWithArray config = new ConfigurationXMLWithArray();
535 -  
536 - CoreBootstrap coreBootstrap = createMock(CoreBootstrap.class); 533 + CoreBootstrap coreBootstrap = PowerMock.createMock(CoreBootstrap.class);
  534 +
  535 + expect(Beans.getReference(CoreBootstrap.class)).andReturn(coreBootstrap);
  536 + expect(Beans.getReference(Locale.class)).andReturn(Locale.getDefault());
  537 +
537 expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true); 538 expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
538 539
539 - replay(CoreBootstrap.class);  
540 - 540 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
  541 +
541 configurationLoader.load(config); 542 configurationLoader.load(config);
542 return config; 543 return config;
543 } 544 }
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/ConfigurationLoaderWithListTest.java
@@ -36,10 +36,9 @@ @@ -36,10 +36,9 @@
36 */ 36 */
37 package br.gov.frameworkdemoiselle.internal.configuration; 37 package br.gov.frameworkdemoiselle.internal.configuration;
38 38
39 -import static org.easymock.EasyMock.createMock;  
40 import static org.easymock.EasyMock.expect; 39 import static org.easymock.EasyMock.expect;
41 import static org.junit.Assert.assertEquals; 40 import static org.junit.Assert.assertEquals;
42 -import static org.powermock.api.easymock.PowerMock.replay; 41 +import static org.powermock.api.easymock.PowerMock.mockStatic;
43 42
44 import java.awt.Color; 43 import java.awt.Color;
45 import java.math.BigDecimal; 44 import java.math.BigDecimal;
@@ -53,21 +52,19 @@ import java.util.Locale; @@ -53,21 +52,19 @@ import java.util.Locale;
53 52
54 import org.junit.After; 53 import org.junit.After;
55 import org.junit.Before; 54 import org.junit.Before;
56 -import org.junit.Ignore;  
57 import org.junit.Test; 55 import org.junit.Test;
58 import org.junit.runner.RunWith; 56 import org.junit.runner.RunWith;
59 import org.powermock.api.easymock.PowerMock; 57 import org.powermock.api.easymock.PowerMock;
  58 +import org.powermock.core.classloader.annotations.PrepareForTest;
60 import org.powermock.modules.junit4.PowerMockRunner; 59 import org.powermock.modules.junit4.PowerMockRunner;
61 -import org.powermock.reflect.Whitebox;  
62 -import org.slf4j.Logger;  
63 60
64 import br.gov.frameworkdemoiselle.configuration.ConfigType; 61 import br.gov.frameworkdemoiselle.configuration.ConfigType;
65 import br.gov.frameworkdemoiselle.configuration.Configuration; 62 import br.gov.frameworkdemoiselle.configuration.Configuration;
66 import br.gov.frameworkdemoiselle.internal.bootstrap.CoreBootstrap; 63 import br.gov.frameworkdemoiselle.internal.bootstrap.CoreBootstrap;
67 -import br.gov.frameworkdemoiselle.util.ResourceBundle; 64 +import br.gov.frameworkdemoiselle.util.Beans;
68 65
69 -@Ignore  
70 @RunWith(PowerMockRunner.class) 66 @RunWith(PowerMockRunner.class)
  67 +@PrepareForTest(Beans.class)
71 public class ConfigurationLoaderWithListTest { 68 public class ConfigurationLoaderWithListTest {
72 69
73 private ConfigurationLoader configurationLoader; 70 private ConfigurationLoader configurationLoader;
@@ -150,13 +147,7 @@ public class ConfigurationLoaderWithListTest { @@ -150,13 +147,7 @@ public class ConfigurationLoaderWithListTest {
150 147
151 @Before 148 @Before
152 public void setUp() throws Exception { 149 public void setUp() throws Exception {
153 - Logger logger;  
154 - ResourceBundle bundle;  
155 - logger = PowerMock.createMock(Logger.class);  
156 - bundle = new ResourceBundle("demoiselle-core-bundle", Locale.getDefault());  
157 configurationLoader = new ConfigurationLoader(); 150 configurationLoader = new ConfigurationLoader();
158 - Whitebox.setInternalState(this.configurationLoader, "bundle", bundle);  
159 - Whitebox.setInternalState(this.configurationLoader, "logger", logger);  
160 } 151 }
161 152
162 @After 153 @After
@@ -342,12 +333,17 @@ public class ConfigurationLoaderWithListTest { @@ -342,12 +333,17 @@ public class ConfigurationLoaderWithListTest {
342 } 333 }
343 334
344 private ConfigurationPropertiesWithList prepareConfigurationPropertiesWithList() { 335 private ConfigurationPropertiesWithList prepareConfigurationPropertiesWithList() {
  336 + mockStatic(Beans.class);
  337 + CoreBootstrap coreBootstrap = PowerMock.createMock(CoreBootstrap.class);
  338 +
  339 + expect(Beans.getReference(CoreBootstrap.class)).andReturn(coreBootstrap);
  340 + expect(Beans.getReference(Locale.class)).andReturn(Locale.getDefault());
  341 +
345 ConfigurationPropertiesWithList config = new ConfigurationPropertiesWithList(); 342 ConfigurationPropertiesWithList config = new ConfigurationPropertiesWithList();
346 343
347 - CoreBootstrap coreBootstrap = createMock(CoreBootstrap.class);  
348 expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true); 344 expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
349 345
350 - replay(coreBootstrap); 346 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
351 347
352 configurationLoader.load(config); 348 configurationLoader.load(config);
353 return config; 349 return config;
@@ -532,12 +528,17 @@ public class ConfigurationLoaderWithListTest { @@ -532,12 +528,17 @@ public class ConfigurationLoaderWithListTest {
532 } 528 }
533 529
534 private ConfigurationXMLWithList prepareConfigurationXMLWithList() { 530 private ConfigurationXMLWithList prepareConfigurationXMLWithList() {
  531 + mockStatic(Beans.class);
  532 + CoreBootstrap coreBootstrap = PowerMock.createMock(CoreBootstrap.class);
  533 +
  534 + expect(Beans.getReference(CoreBootstrap.class)).andReturn(coreBootstrap);
  535 + expect(Beans.getReference(Locale.class)).andReturn(Locale.getDefault());
  536 +
535 ConfigurationXMLWithList config = new ConfigurationXMLWithList(); 537 ConfigurationXMLWithList config = new ConfigurationXMLWithList();
536 538
537 - CoreBootstrap coreBootstrap = createMock(CoreBootstrap.class);  
538 expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true); 539 expect(coreBootstrap.isAnnotatedType(config.getClass())).andReturn(true);
539 540
540 - replay(coreBootstrap); 541 + PowerMock.replayAll(CoreBootstrap.class,Beans.class);
541 542
542 configurationLoader.load(config); 543 configurationLoader.load(config);
543 return config; 544 return config;
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/PaginationConfigTest.java
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 package br.gov.frameworkdemoiselle.internal.configuration; 37 package br.gov.frameworkdemoiselle.internal.configuration;
38 38
39 import static org.junit.Assert.assertEquals; 39 import static org.junit.Assert.assertEquals;
40 -import org.junit.Ignore; 40 +
41 import org.junit.Before; 41 import org.junit.Before;
42 import org.junit.Test; 42 import org.junit.Test;
43 43
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/SecurityConfigTest.java
1 package br.gov.frameworkdemoiselle.internal.configuration; 1 package br.gov.frameworkdemoiselle.internal.configuration;
2 2
3 -import org.junit.Ignore;  
4 import static org.junit.Assert.assertEquals; 3 import static org.junit.Assert.assertEquals;
5 4
6 import org.junit.Before; 5 import org.junit.Before;
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/context/ContextsTest.java
@@ -37,14 +37,18 @@ @@ -37,14 +37,18 @@
37 package br.gov.frameworkdemoiselle.internal.context; 37 package br.gov.frameworkdemoiselle.internal.context;
38 38
39 import static org.easymock.EasyMock.createMock; 39 import static org.easymock.EasyMock.createMock;
  40 +import static org.easymock.EasyMock.expect;
40 import static org.easymock.EasyMock.expectLastCall; 41 import static org.easymock.EasyMock.expectLastCall;
41 -import static org.easymock.EasyMock.replay; 42 +//import static org.easymock.EasyMock.replay;
  43 +import static org.powermock.api.easymock.PowerMock.mockStatic;
  44 +import static org.powermock.api.easymock.PowerMock.replay;
42 import static org.junit.Assert.assertEquals; 45 import static org.junit.Assert.assertEquals;
43 import static org.junit.Assert.assertFalse; 46 import static org.junit.Assert.assertFalse;
44 import static org.junit.Assert.assertTrue; 47 import static org.junit.Assert.assertTrue;
45 48
46 import java.util.ArrayList; 49 import java.util.ArrayList;
47 import java.util.List; 50 import java.util.List;
  51 +import java.util.Locale;
48 52
49 import javax.enterprise.context.ApplicationScoped; 53 import javax.enterprise.context.ApplicationScoped;
50 import javax.enterprise.context.RequestScoped; 54 import javax.enterprise.context.RequestScoped;
@@ -53,9 +57,15 @@ import javax.enterprise.inject.spi.AfterBeanDiscovery; @@ -53,9 +57,15 @@ import javax.enterprise.inject.spi.AfterBeanDiscovery;
53 57
54 import org.junit.Before; 58 import org.junit.Before;
55 import org.junit.Test; 59 import org.junit.Test;
  60 +import org.junit.runner.RunWith;
  61 +import org.powermock.core.classloader.annotations.PrepareForTest;
  62 +import org.powermock.modules.junit4.PowerMockRunner;
56 63
57 import br.gov.frameworkdemoiselle.annotation.ViewScoped; 64 import br.gov.frameworkdemoiselle.annotation.ViewScoped;
  65 +import br.gov.frameworkdemoiselle.util.Beans;
58 66
  67 +@RunWith(PowerMockRunner.class)
  68 +@PrepareForTest(Beans.class)
59 public class ContextsTest { 69 public class ContextsTest {
60 70
61 private AfterBeanDiscovery event; 71 private AfterBeanDiscovery event;
@@ -63,6 +73,11 @@ public class ContextsTest { @@ -63,6 +73,11 @@ public class ContextsTest {
63 @Before 73 @Before
64 public void setUp() throws Exception { 74 public void setUp() throws Exception {
65 Contexts.clear(); 75 Contexts.clear();
  76 + mockStatic(Beans.class);
  77 +
  78 + expect(Beans.getReference(Locale.class)).andReturn(Locale.getDefault());
  79 +
  80 + replay(Beans.class);
66 } 81 }
67 82
68 @Test 83 @Test
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/producer/LoggerProducerTest.java
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. 35 * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36 */ 36 */
37 package br.gov.frameworkdemoiselle.internal.producer; 37 package br.gov.frameworkdemoiselle.internal.producer;
  38 +
38 import org.junit.Ignore; 39 import org.junit.Ignore;
39 import static org.easymock.EasyMock.createMock; 40 import static org.easymock.EasyMock.createMock;
40 import static org.easymock.EasyMock.expect; 41 import static org.easymock.EasyMock.expect;
@@ -47,7 +48,7 @@ import javax.enterprise.inject.spi.InjectionPoint; @@ -47,7 +48,7 @@ import javax.enterprise.inject.spi.InjectionPoint;
47 48
48 import org.junit.Test; 49 import org.junit.Test;
49 import org.slf4j.Logger; 50 import org.slf4j.Logger;
50 -@Ignore 51 +
51 public class LoggerProducerTest { 52 public class LoggerProducerTest {
52 53
53 private Logger logger; 54 private Logger logger;
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/producer/ResourceBundleProducerTest.java
@@ -35,20 +35,35 @@ @@ -35,20 +35,35 @@
35 * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. 35 * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36 */ 36 */
37 package br.gov.frameworkdemoiselle.internal.producer; 37 package br.gov.frameworkdemoiselle.internal.producer;
38 -import org.junit.Ignore; 38 +
  39 +import static org.easymock.EasyMock.expect;
39 import static org.junit.Assert.assertTrue; 40 import static org.junit.Assert.assertTrue;
  41 +import static org.powermock.api.easymock.PowerMock.mockStatic;
  42 +import static org.powermock.api.easymock.PowerMock.replay;
40 43
41 import java.util.Locale; 44 import java.util.Locale;
42 45
  46 +import javax.enterprise.inject.spi.Annotated;
  47 +import javax.enterprise.inject.spi.InjectionPoint;
  48 +
  49 +import org.easymock.EasyMock;
43 import org.junit.After; 50 import org.junit.After;
44 import org.junit.AfterClass; 51 import org.junit.AfterClass;
45 import org.junit.Assert; 52 import org.junit.Assert;
46 import org.junit.Before; 53 import org.junit.Before;
47 import org.junit.BeforeClass; 54 import org.junit.BeforeClass;
48 import org.junit.Test; 55 import org.junit.Test;
  56 +import org.junit.runner.RunWith;
  57 +import org.powermock.core.classloader.annotations.PrepareForTest;
  58 +import org.powermock.modules.junit4.PowerMockRunner;
49 59
50 import br.gov.frameworkdemoiselle.DemoiselleException; 60 import br.gov.frameworkdemoiselle.DemoiselleException;
51 -@Ignore 61 +import br.gov.frameworkdemoiselle.annotation.Name;
  62 +import br.gov.frameworkdemoiselle.util.Beans;
  63 +import br.gov.frameworkdemoiselle.util.ResourceBundle;
  64 +
  65 +@RunWith(PowerMockRunner.class)
  66 +@PrepareForTest(Beans.class)
52 public class ResourceBundleProducerTest { 67 public class ResourceBundleProducerTest {
53 68
54 @BeforeClass 69 @BeforeClass
@@ -61,6 +76,11 @@ public class ResourceBundleProducerTest { @@ -61,6 +76,11 @@ public class ResourceBundleProducerTest {
61 76
62 @Before 77 @Before
63 public void setUp() throws Exception { 78 public void setUp() throws Exception {
  79 + mockStatic(Beans.class);
  80 +
  81 + expect(Beans.getReference(Locale.class)).andReturn(Locale.getDefault());
  82 +
  83 + replay(Beans.class);
64 } 84 }
65 85
66 @After 86 @After
@@ -73,39 +93,31 @@ public class ResourceBundleProducerTest { @@ -73,39 +93,31 @@ public class ResourceBundleProducerTest {
73 Assert.assertNotNull(factory); 93 Assert.assertNotNull(factory);
74 } 94 }
75 95
  96 + @Test
  97 + public void testCreateNullInjectionPoint() {
  98 + ResourceBundleProducer factory = new ResourceBundleProducer();
  99 + ResourceBundle resourceBundle = factory.create((InjectionPoint) null);
  100 + Assert.assertNotNull(resourceBundle);
  101 + }
  102 +
76 @Test 103 @Test
77 - public void testCreateWithNonExistentFile() {  
78 - try {  
79 - ResourceBundleProducer.create("arquivo_inexistente", Locale.getDefault());  
80 - } catch (Exception e) {  
81 - assertTrue(e instanceof DemoiselleException);  
82 - }  
83 - } 104 + public void testCreateInjectionPointNameAnnoted() {
  105 + Name name = EasyMock.createMock(Name.class);
  106 + expect(name.value()).andReturn("demoiselle-core-bundle");
  107 + replay(name);
84 108
85 - // @Test  
86 - // public void testCreateNullInjectionPoint() {  
87 - // ResourceBundleProducer factory = new ResourceBundleProducer();  
88 - // Assert.assertNotNull(factory.create((InjectionPoint) null, Locale.getDefault()));  
89 - // } 109 + Annotated annotated = EasyMock.createMock(Annotated.class);
  110 + expect(annotated.getAnnotation(Name.class)).andReturn(name).anyTimes();
  111 + expect(annotated.isAnnotationPresent(Name.class)).andReturn(true).anyTimes();
  112 + replay(annotated);
90 113
91 - // @Test  
92 - // public void testCreateInjectionPointNameAnnoted() {  
93 - // Name name = EasyMock.createMock(Name.class);  
94 - // expect(name.value()).andReturn("demoiselle-core-bundle");  
95 - // replay(name);  
96 - //  
97 - // Annotated annotated = EasyMock.createMock(Annotated.class);  
98 - // expect(annotated.getAnnotation(Name.class)).andReturn(name).anyTimes();  
99 - // expect(annotated.isAnnotationPresent(Name.class)).andReturn(true).anyTimes();  
100 - // replay(annotated);  
101 - //  
102 - // InjectionPoint ip = EasyMock.createMock(InjectionPoint.class);  
103 - // expect(ip.getAnnotated()).andReturn(annotated).anyTimes();  
104 - // replay(ip);  
105 - //  
106 - // ResourceBundleProducer factory = new ResourceBundleProducer();  
107 - // Assert.assertNotNull(factory.create(ip, Locale.getDefault()));  
108 - // } 114 + InjectionPoint ip = EasyMock.createMock(InjectionPoint.class);
  115 + expect(ip.getAnnotated()).andReturn(annotated).anyTimes();
  116 + replay(ip);
  117 +
  118 + ResourceBundleProducer factory = new ResourceBundleProducer();
  119 + Assert.assertNotNull(factory.create(ip));
  120 + }
109 121
110 // @Test 122 // @Test
111 // public void testCreateInjectionPointNameUnannoted() { 123 // public void testCreateInjectionPointNameUnannoted() {
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/proxy/Slf4jLoggerProxyTest.java
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.internal.proxy;  
38 -//  
39 -//import static org.easymock.EasyMock.expect;  
40 -//import static org.easymock.EasyMock.replay;  
41 -//import static org.easymock.EasyMock.verify;  
42 -//import static org.junit.Assert.assertEquals;  
43 -//  
44 -//import org.easymock.EasyMock;  
45 -//import org.junit.Before;  
46 -//import org.junit.Test;  
47 -//import org.slf4j.Logger;  
48 -//import org.slf4j.Marker;  
49 -//  
50 -//  
51 -//public class Slf4jLoggerProxyTest {  
52 -//  
53 -// private Logger logger;  
54 -// private Slf4jLoggerProxy slf4jLoggerProxy;  
55 -//  
56 -// @Before  
57 -// public void setUp() throws Exception {  
58 -// this.logger = EasyMock.createMock(Logger.class);  
59 -// this.slf4jLoggerProxy = new Slf4jLoggerProxy(this.logger);  
60 -// }  
61 -//  
62 -// @Test  
63 -// public void testDebugWithMarkerAndString() {  
64 -// Marker marker = null;  
65 -// this.logger.debug(marker,"");  
66 -// replay(this.logger);  
67 -// this.slf4jLoggerProxy.debug(marker,"");  
68 -// verify(this.logger);  
69 -// }  
70 -// @Test  
71 -// public void testDebugWithMarkerStringAndOneObject() {  
72 -// Marker marker = null;  
73 -// Object obj = null;  
74 -// this.logger.debug(marker,"",obj);  
75 -// replay(this.logger);  
76 -// this.slf4jLoggerProxy.debug(marker,"",obj);  
77 -// verify(this.logger);  
78 -// }  
79 -// @Test  
80 -// public void testDebugWithMarkerStringAndTwoObjects() {  
81 -// Marker marker = null;  
82 -// Object obj1 = null, obj2 = null;  
83 -// this.logger.debug(marker,"",obj1,obj2);  
84 -// replay(this.logger);  
85 -// this.slf4jLoggerProxy.debug(marker,"",obj1,obj2);  
86 -// verify(this.logger);  
87 -// }  
88 -// @Test  
89 -// public void testDebugWithMarkerStringAndObjectArray() {  
90 -// Marker marker = null;  
91 -// Object[] obj = null;  
92 -// this.logger.debug(marker,"",obj);  
93 -// replay(this.logger);  
94 -// this.slf4jLoggerProxy.debug(marker,"",obj);  
95 -// verify(this.logger);  
96 -// }  
97 -//  
98 -// @Test  
99 -// public void testDebugWithMarkerStringAndThrowable() {  
100 -// Marker marker = null;  
101 -// Throwable t = null;  
102 -// this.logger.debug(marker,"",t);  
103 -// replay(this.logger);  
104 -// this.slf4jLoggerProxy.debug(marker,"",t);  
105 -// verify(this.logger);  
106 -// }  
107 -// @Test  
108 -// public void testDebugWithString() {  
109 -// this.logger.debug("");  
110 -// replay(this.logger);  
111 -// this.slf4jLoggerProxy.debug("");  
112 -// verify(this.logger);  
113 -// }  
114 -// @Test  
115 -// public void testDebugWithStringAndOneObject() {  
116 -// Object obj = null;  
117 -// this.logger.debug("",obj);  
118 -// replay(this.logger);  
119 -// this.slf4jLoggerProxy.debug("",obj);  
120 -// verify(this.logger);  
121 -// }  
122 -// @Test  
123 -// public void testDebugWithStringAndTwoObjects() {  
124 -// Object obj1 = null, obj2 = null;  
125 -// this.logger.debug("",obj1,obj2);  
126 -// replay(this.logger);  
127 -// this.slf4jLoggerProxy.debug("",obj1,obj2);  
128 -// verify(this.logger);  
129 -// }  
130 -// @Test  
131 -// public void testDebugWithStringAndObjectArray() {  
132 -// Object[] obj = null;  
133 -// this.logger.debug("",obj);  
134 -// replay(this.logger);  
135 -// this.slf4jLoggerProxy.debug("",obj);  
136 -// verify(this.logger);  
137 -// }  
138 -// @Test  
139 -// public void testDebugWithStringAndThrowable() {  
140 -// Throwable t = null;  
141 -// this.logger.debug("",t);  
142 -// replay(this.logger);  
143 -// this.slf4jLoggerProxy.debug("",t);  
144 -// verify(this.logger);  
145 -// }  
146 -// @Test  
147 -// public void testErrorWithMarkerAndString() {  
148 -// Marker marker = null;  
149 -// this.logger.error(marker,"");  
150 -// replay(this.logger);  
151 -// this.slf4jLoggerProxy.error(marker,"");  
152 -// verify(this.logger);  
153 -// }  
154 -// @Test  
155 -// public void testErrorWithMarkerStringAndOneObject() {  
156 -// Marker marker = null;  
157 -// Object obj = null;  
158 -// this.logger.error(marker,"",obj);  
159 -// replay(this.logger);  
160 -// this.slf4jLoggerProxy.error(marker,"",obj);  
161 -// verify(this.logger);  
162 -// }  
163 -// @Test  
164 -// public void testErrorWithMarkerStringAndTwoObjects() {  
165 -// Marker marker = null;  
166 -// Object obj1 = null, obj2 = null;  
167 -// this.logger.error(marker,"",obj1,obj2);  
168 -// replay(this.logger);  
169 -// this.slf4jLoggerProxy.error(marker,"",obj1,obj2);  
170 -// verify(this.logger);  
171 -// }  
172 -// @Test  
173 -// public void testErrorWithMarkerStringAndObjectArray() {  
174 -// Marker marker = null;  
175 -// Object[] obj1 = null;  
176 -// this.logger.error(marker,"",obj1);  
177 -// replay(this.logger);  
178 -// this.slf4jLoggerProxy.error(marker,"",obj1);  
179 -// verify(this.logger);  
180 -// }  
181 -// @Test  
182 -// public void testErrorWithMarkerStringAndThrowable() {  
183 -// Marker marker = null;  
184 -// Throwable t = null;  
185 -// this.logger.error(marker,"",t);  
186 -// replay(this.logger);  
187 -// this.slf4jLoggerProxy.error(marker,"",t);  
188 -// verify(this.logger);  
189 -// }  
190 -// @Test  
191 -// public void testErrorWithString() {  
192 -// this.logger.error("");  
193 -// replay(this.logger);  
194 -// this.slf4jLoggerProxy.error("");  
195 -// verify(this.logger);  
196 -// }  
197 -// @Test  
198 -// public void testErrorWithStringAndOneObject() {  
199 -// Object obj = null;  
200 -// this.logger.error("",obj);  
201 -// replay(this.logger);  
202 -// this.slf4jLoggerProxy.error("",obj);  
203 -// verify(this.logger);  
204 -// }  
205 -// @Test  
206 -// public void testErrorWithStringAndTwoObjects() {  
207 -// Object obj1 = null,obj2 = null;  
208 -// this.logger.error("",obj1,obj2);  
209 -// replay(this.logger);  
210 -// this.slf4jLoggerProxy.error("",obj1,obj2);  
211 -// verify(this.logger);  
212 -// }  
213 -// @Test  
214 -// public void testErrorWithStringAndObjectArray() {  
215 -// Object[] obj = null;  
216 -// this.logger.error("",obj);  
217 -// replay(this.logger);  
218 -// this.slf4jLoggerProxy.error("",obj);  
219 -// verify(this.logger);  
220 -// }  
221 -// @Test  
222 -// public void testErrorWithStringAndThrowable() {  
223 -// Throwable t = null;  
224 -// this.logger.error("",t);  
225 -// replay(this.logger);  
226 -// this.slf4jLoggerProxy.error("",t);  
227 -// verify(this.logger);  
228 -// }  
229 -// @Test  
230 -// public void testGetName() {  
231 -// expect(this.logger.getName()).andReturn("xxx");  
232 -// replay(this.logger);  
233 -// assertEquals("xxx", this.slf4jLoggerProxy.getName());  
234 -// verify(this.logger);  
235 -// }  
236 -// @Test  
237 -// public void testInfoWithMarkerAndString() {  
238 -// Marker marker = null;  
239 -// this.logger.info(marker,"");  
240 -// replay(this.logger);  
241 -// this.slf4jLoggerProxy.info(marker,"");  
242 -// verify(this.logger);  
243 -// }  
244 -// @Test  
245 -// public void testInfoWithMarkerStringAndOneObject() {  
246 -// Marker marker = null;  
247 -// Object obj = null;  
248 -// this.logger.info(marker,"",obj);  
249 -// replay(this.logger);  
250 -// this.slf4jLoggerProxy.info(marker,"",obj);  
251 -// verify(this.logger);  
252 -// }  
253 -// @Test  
254 -// public void testInfoWithMarkerStringAndTwoObjects() {  
255 -// Marker marker = null;  
256 -// Object obj1 = null, obj2 = null;  
257 -// this.logger.info(marker,"",obj1, obj2);  
258 -// replay(this.logger);  
259 -// this.slf4jLoggerProxy.info(marker,"",obj1,obj2);  
260 -// verify(this.logger);  
261 -// }  
262 -// @Test  
263 -// public void testInfoWithMarkerStringAndObjectArray() {  
264 -// Marker marker = null;  
265 -// Object[] obj = null;  
266 -// this.logger.info(marker,"",obj);  
267 -// replay(this.logger);  
268 -// this.slf4jLoggerProxy.info(marker,"",obj);  
269 -// verify(this.logger);  
270 -// }  
271 -// @Test  
272 -// public void testInfoWithMarkerStringAndThrowable() {  
273 -// Marker marker = null;  
274 -// Throwable t = null;  
275 -// this.logger.info(marker,"",t);  
276 -// replay(this.logger);  
277 -// this.slf4jLoggerProxy.info(marker,"",t);  
278 -// verify(this.logger);  
279 -// }  
280 -// @Test  
281 -// public void testInfoWithString() {  
282 -// this.logger.info("");  
283 -// replay(this.logger);  
284 -// this.slf4jLoggerProxy.info("");  
285 -// verify(this.logger);  
286 -// }  
287 -// @Test  
288 -// public void testInfoWithStringAndOneObject() {  
289 -// Object obj = null;  
290 -// this.logger.info("",obj);  
291 -// replay(this.logger);  
292 -// this.slf4jLoggerProxy.info("",obj);  
293 -// verify(this.logger);  
294 -// }  
295 -// @Test  
296 -// public void testInfoWithStringAndTwoObjects() {  
297 -// Object obj1 = null, obj2 = null;  
298 -// this.logger.info("",obj1,obj2);  
299 -// replay(this.logger);  
300 -// this.slf4jLoggerProxy.info("",obj1,obj2);  
301 -// verify(this.logger);  
302 -// }  
303 -// @Test  
304 -// public void testInfoWithStringAndObjectArray() {  
305 -// Object[] obj = null;  
306 -// this.logger.info("",obj);  
307 -// replay(this.logger);  
308 -// this.slf4jLoggerProxy.info("",obj);  
309 -// verify(this.logger);  
310 -// }  
311 -// @Test  
312 -// public void testInfoWithStringAndThrowable() {  
313 -// Throwable t = null;  
314 -// this.logger.info("",t);  
315 -// replay(this.logger);  
316 -// this.slf4jLoggerProxy.info("",t);  
317 -// verify(this.logger);  
318 -// }  
319 -// @Test  
320 -// public void testIsDebugEnabled() {  
321 -// expect(this.logger.isDebugEnabled()).andReturn(true);  
322 -// replay(this.logger);  
323 -// assertEquals(true, this.slf4jLoggerProxy.isDebugEnabled());  
324 -// verify(this.logger);  
325 -// }  
326 -// @Test  
327 -// public void testIsDebugEnabledWithMarker() {  
328 -// Marker marker = null;  
329 -// expect(this.logger.isDebugEnabled(marker)).andReturn(true);  
330 -// replay(this.logger);  
331 -// assertEquals(true, this.slf4jLoggerProxy.isDebugEnabled(marker));  
332 -// verify(this.logger);  
333 -// }  
334 -// @Test  
335 -// public void testIsErrorEnabled() {  
336 -// expect(this.logger.isErrorEnabled()).andReturn(true);  
337 -// replay(this.logger);  
338 -// assertEquals(true, this.slf4jLoggerProxy.isErrorEnabled());  
339 -// verify(this.logger);  
340 -// }  
341 -// @Test  
342 -// public void testIsErrorEnabledWithMarker() {  
343 -// Marker marker = null;  
344 -// expect(this.logger.isErrorEnabled(marker)).andReturn(true);  
345 -// replay(this.logger);  
346 -// assertEquals(true, this.slf4jLoggerProxy.isErrorEnabled(marker));  
347 -// verify(this.logger);  
348 -// }  
349 -// @Test  
350 -// public void testIsInfoEnabled() {  
351 -// expect(this.logger.isInfoEnabled()).andReturn(true);  
352 -// replay(this.logger);  
353 -// assertEquals(true, this.slf4jLoggerProxy.isInfoEnabled());  
354 -// verify(this.logger);  
355 -// }  
356 -// @Test  
357 -// public void testIsInfoEnabledWithMarker() {  
358 -// Marker marker = null;  
359 -// expect(this.logger.isInfoEnabled(marker)).andReturn(true);  
360 -// replay(this.logger);  
361 -// assertEquals(true, this.slf4jLoggerProxy.isInfoEnabled(marker));  
362 -// verify(this.logger);  
363 -// }  
364 -// @Test  
365 -// public void testIsTRaceEnabled() {  
366 -// expect(this.logger.isTraceEnabled()).andReturn(true);  
367 -// replay(this.logger);  
368 -// assertEquals(true, this.slf4jLoggerProxy.isTraceEnabled());  
369 -// verify(this.logger);  
370 -// }  
371 -// @Test  
372 -// public void testIsTraceEnabledWithMarker() {  
373 -// Marker marker = null;  
374 -// expect(this.logger.isTraceEnabled(marker)).andReturn(true);  
375 -// replay(this.logger);  
376 -// assertEquals(true, this.slf4jLoggerProxy.isTraceEnabled(marker));  
377 -// verify(this.logger);  
378 -// }  
379 -// @Test  
380 -// public void testIsWarnEnabled() {  
381 -// expect(this.logger.isWarnEnabled()).andReturn(true);  
382 -// replay(this.logger);  
383 -// assertEquals(true, this.slf4jLoggerProxy.isWarnEnabled());  
384 -// verify(this.logger);  
385 -// }  
386 -// @Test  
387 -// public void testIsWarnEnabledWithMarker() {  
388 -// Marker marker = null;  
389 -// expect(this.logger.isWarnEnabled(marker)).andReturn(true);  
390 -// replay(this.logger);  
391 -// assertEquals(true, this.slf4jLoggerProxy.isWarnEnabled(marker));  
392 -// verify(this.logger);  
393 -// }  
394 -// @Test  
395 -// public void testTraceWithMarkerAndString() {  
396 -// Marker marker = null;  
397 -// this.logger.trace(marker,"");  
398 -// replay(this.logger);  
399 -// this.slf4jLoggerProxy.trace(marker,"");  
400 -// verify(this.logger);  
401 -// }  
402 -// @Test  
403 -// public void testTraceWithMarkerStringAndOneObject() {  
404 -// Marker marker = null;  
405 -// Object obj = null;  
406 -// this.logger.trace(marker,"",obj);  
407 -// replay(this.logger);  
408 -// this.slf4jLoggerProxy.trace(marker,"",obj);  
409 -// verify(this.logger);  
410 -// }  
411 -// @Test  
412 -// public void testTraceWithMarkerStringAndTwoObjects() {  
413 -// Marker marker = null;  
414 -// Object obj1 = null, obj2 = null;  
415 -// this.logger.trace(marker,"",obj1, obj2);  
416 -// replay(this.logger);  
417 -// this.slf4jLoggerProxy.trace(marker,"",obj1,obj2);  
418 -// verify(this.logger);  
419 -// }  
420 -// @Test  
421 -// public void testTraceWithMarkerStringAndObjectArray() {  
422 -// Marker marker = null;  
423 -// Object[] obj = null;  
424 -// this.logger.trace(marker,"",obj);  
425 -// replay(this.logger);  
426 -// this.slf4jLoggerProxy.trace(marker,"",obj);  
427 -// verify(this.logger);  
428 -// }  
429 -// @Test  
430 -// public void testTraceWithMarkerStringAndThrowable() {  
431 -// Marker marker = null;  
432 -// Throwable t = null;  
433 -// this.logger.trace(marker,"",t);  
434 -// replay(this.logger);  
435 -// this.slf4jLoggerProxy.trace(marker,"",t);  
436 -// verify(this.logger);  
437 -// }  
438 -// @Test  
439 -// public void testTraceWithString() {  
440 -// this.logger.trace("");  
441 -// replay(this.logger);  
442 -// this.slf4jLoggerProxy.trace("");  
443 -// verify(this.logger);  
444 -// }  
445 -// @Test  
446 -// public void testTraceWithStringAndOneObject() {  
447 -// Object obj = null;  
448 -// this.logger.trace("",obj);  
449 -// replay(this.logger);  
450 -// this.slf4jLoggerProxy.trace("",obj);  
451 -// verify(this.logger);  
452 -// }  
453 -// @Test  
454 -// public void testTraceWithStringAndTwoObjects() {  
455 -// Object obj1 = null, obj2 = null;  
456 -// this.logger.trace("",obj1,obj2);  
457 -// replay(this.logger);  
458 -// this.slf4jLoggerProxy.trace("",obj1,obj2);  
459 -// verify(this.logger);  
460 -// }  
461 -// @Test  
462 -// public void testTraceWithStringAndObjectArray() {  
463 -// Object[] obj = null;  
464 -// this.logger.trace("",obj);  
465 -// replay(this.logger);  
466 -// this.slf4jLoggerProxy.trace("",obj);  
467 -// verify(this.logger);  
468 -// }  
469 -// @Test  
470 -// public void testTraceWithStringAndThrowable() {  
471 -// Throwable t = null;  
472 -// this.logger.trace("",t);  
473 -// replay(this.logger);  
474 -// this.slf4jLoggerProxy.trace("",t);  
475 -// verify(this.logger);  
476 -// }  
477 -// @Test  
478 -// public void testWarnWithMarkerAndString() {  
479 -// Marker marker = null;  
480 -// this.logger.warn(marker,"");  
481 -// replay(this.logger);  
482 -// this.slf4jLoggerProxy.warn(marker,"");  
483 -// verify(this.logger);  
484 -// }  
485 -// @Test  
486 -// public void testWarnWithMarkerStringAndOneObject() {  
487 -// Marker marker = null;  
488 -// Object obj = null;  
489 -// this.logger.warn(marker,"",obj);  
490 -// replay(this.logger);  
491 -// this.slf4jLoggerProxy.warn(marker,"",obj);  
492 -// verify(this.logger);  
493 -// }  
494 -// @Test  
495 -// public void testWarnWithMarkerStringAndTwoObjects() {  
496 -// Marker marker = null;  
497 -// Object obj1 = null, obj2 = null;  
498 -// this.logger.warn(marker,"",obj1, obj2);  
499 -// replay(this.logger);  
500 -// this.slf4jLoggerProxy.warn(marker,"",obj1,obj2);  
501 -// verify(this.logger);  
502 -// }  
503 -// @Test  
504 -// public void testWarnWithMarkerStringAndObjectArray() {  
505 -// Marker marker = null;  
506 -// Object[] obj = null;  
507 -// this.logger.warn(marker,"",obj);  
508 -// replay(this.logger);  
509 -// this.slf4jLoggerProxy.warn(marker,"",obj);  
510 -// verify(this.logger);  
511 -// }  
512 -// @Test  
513 -// public void testWarnWithMarkerStringAndThrowable() {  
514 -// Marker marker = null;  
515 -// Throwable t = null;  
516 -// this.logger.warn(marker,"",t);  
517 -// replay(this.logger);  
518 -// this.slf4jLoggerProxy.warn(marker,"",t);  
519 -// verify(this.logger);  
520 -// }  
521 -// @Test  
522 -// public void testWarnWithString() {  
523 -// this.logger.warn("");  
524 -// replay(this.logger);  
525 -// this.slf4jLoggerProxy.warn("");  
526 -// verify(this.logger);  
527 -// }  
528 -// @Test  
529 -// public void testWarnWithStringAndOneObject() {  
530 -// Object obj = null;  
531 -// this.logger.warn("",obj);  
532 -// replay(this.logger);  
533 -// this.slf4jLoggerProxy.warn("",obj);  
534 -// verify(this.logger);  
535 -// }  
536 -// @Test  
537 -// public void testWarnWithStringAndTwoObjects() {  
538 -// Object obj1 = null, obj2 = null;  
539 -// this.logger.warn("",obj1,obj2);  
540 -// replay(this.logger);  
541 -// this.slf4jLoggerProxy.warn("",obj1,obj2);  
542 -// verify(this.logger);  
543 -// }  
544 -// @Test  
545 -// public void testWarnWithStringAndObjectArray() {  
546 -// Object[] obj = null;  
547 -// this.logger.warn("",obj);  
548 -// replay(this.logger);  
549 -// this.slf4jLoggerProxy.warn("",obj);  
550 -// verify(this.logger);  
551 -// }  
552 -// @Test  
553 -// public void testWarnWithStringAndThrowable() {  
554 -// Throwable t = null;  
555 -// this.logger.warn("",t);  
556 -// replay(this.logger);  
557 -// this.slf4jLoggerProxy.warn("",t);  
558 -// verify(this.logger);  
559 -// }  
560 -//} 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.internal.proxy;
  38 +
  39 +import static org.easymock.EasyMock.expect;
  40 +import static org.easymock.EasyMock.replay;
  41 +import static org.easymock.EasyMock.verify;
  42 +import static org.junit.Assert.assertEquals;
  43 +import static org.powermock.api.easymock.PowerMock.mockStatic;
  44 +
  45 +import javax.inject.Inject;
  46 +
  47 +import org.easymock.EasyMock;
  48 +import org.junit.Before;
  49 +import org.junit.Test;
  50 +import org.junit.runner.RunWith;
  51 +import org.powermock.api.easymock.PowerMock;
  52 +import org.powermock.core.classloader.annotations.PrepareForTest;
  53 +import org.powermock.modules.junit4.PowerMockRunner;
  54 +import org.slf4j.Logger;
  55 +import org.slf4j.LoggerFactory;
  56 +import org.slf4j.Marker;
  57 +
  58 +@RunWith(PowerMockRunner.class)
  59 +@PrepareForTest(LoggerFactory.class)
  60 +public class Slf4jLoggerProxyTest {
  61 +
  62 + private Logger logger;
  63 + private Slf4jLoggerProxy slf4jLoggerProxy;
  64 +
  65 + @Before
  66 + public void setUp() throws Exception {
  67 + this.logger = EasyMock.createMock(Logger.class);
  68 + this.slf4jLoggerProxy = new Slf4jLoggerProxy(Logger.class);
  69 +
  70 + mockStatic(LoggerFactory.class);
  71 +
  72 + expect(LoggerFactory.getLogger(EasyMock.anyObject(Class.class))).andReturn(logger);
  73 + }
  74 +
  75 + @Test//1
  76 + public void testDebugWithMarkerAndString() {
  77 + Marker marker = null;
  78 + this.logger.debug(marker,"");
  79 + PowerMock.replay(LoggerFactory.class, this.logger);
  80 + this.slf4jLoggerProxy.debug(marker,"");
  81 + PowerMock.verify(this.logger);
  82 + }
  83 +
  84 + @Test//2
  85 + public void testDebugWithMarkerStringAndOneObject() {
  86 + Marker marker = null;
  87 + Object obj = null;
  88 + this.logger.debug(marker,"",obj);
  89 + PowerMock.replay(LoggerFactory.class, this.logger);
  90 + this.slf4jLoggerProxy.debug(marker,"",obj);
  91 + PowerMock.verify(this.logger);
  92 + }
  93 +
  94 + @Test//3
  95 + public void testDebugWithMarkerStringAndTwoObjects() {
  96 + Marker marker = null;
  97 + Object obj1 = null, obj2 = null;
  98 + this.logger.debug(marker,"",obj1,obj2);
  99 + PowerMock.replay(LoggerFactory.class, this.logger);
  100 + this.slf4jLoggerProxy.debug(marker,"",obj1,obj2);
  101 + PowerMock.verify(this.logger);
  102 + }
  103 +
  104 + @Test//4
  105 + public void testDebugWithMarkerStringAndObjectArray() {
  106 + Marker marker = null;
  107 + Object[] obj = null;
  108 + this.logger.debug(marker,"",obj);
  109 + PowerMock.replay(LoggerFactory.class, this.logger);
  110 + this.slf4jLoggerProxy.debug(marker,"",obj);
  111 + PowerMock.verify(this.logger);
  112 + }
  113 +
  114 + @Test//5
  115 + public void testDebugWithMarkerStringAndThrowable() {
  116 + Marker marker = null;
  117 + Throwable t = null;
  118 + this.logger.debug(marker,"",t);
  119 + PowerMock.replay(LoggerFactory.class, this.logger);
  120 + this.slf4jLoggerProxy.debug(marker,"",t);
  121 + PowerMock.verify(this.logger);
  122 + }
  123 +
  124 + @Test//6
  125 + public void testDebugWithString() {
  126 + this.logger.debug("");
  127 + PowerMock.replay(LoggerFactory.class, this.logger);
  128 + this.slf4jLoggerProxy.debug("");
  129 + PowerMock.verify(this.logger);
  130 + }
  131 +
  132 + @Test//7
  133 + public void testDebugWithStringAndOneObject() {
  134 + Object obj = null;
  135 + this.logger.debug("",obj);
  136 + PowerMock.replay(LoggerFactory.class, this.logger);
  137 + this.slf4jLoggerProxy.debug("",obj);
  138 + PowerMock.verify(this.logger);
  139 + }
  140 +
  141 + @Test//8
  142 + public void testDebugWithStringAndTwoObjects() {
  143 + Object obj1 = null, obj2 = null;
  144 + this.logger.debug("",obj1,obj2);
  145 + PowerMock.replay(LoggerFactory.class, this.logger);
  146 + this.slf4jLoggerProxy.debug("",obj1,obj2);
  147 + PowerMock.verify(this.logger);
  148 + }
  149 +
  150 + @Test//9
  151 + public void testDebugWithStringAndObjectArray() {
  152 + Object[] obj = null;
  153 + this.logger.debug("",obj);
  154 + PowerMock.replay(LoggerFactory.class, this.logger);
  155 + this.slf4jLoggerProxy.debug("",obj);
  156 + PowerMock.verify(this.logger);
  157 + }
  158 +
  159 + @Test//10
  160 + public void testDebugWithStringAndThrowable() {
  161 + Throwable t = null;
  162 + this.logger.debug("",t);
  163 + PowerMock.replay(LoggerFactory.class, this.logger);
  164 + this.slf4jLoggerProxy.debug("",t);
  165 + PowerMock.verify(this.logger);
  166 + }
  167 +
  168 + @Test//11
  169 + public void testErrorWithMarkerAndString() {
  170 + Marker marker = null;
  171 + this.logger.error(marker,"");
  172 + PowerMock.replay(LoggerFactory.class, this.logger);
  173 + this.slf4jLoggerProxy.error(marker,"");
  174 + PowerMock.verify(this.logger);
  175 + }
  176 +
  177 + @Test//12
  178 + public void testErrorWithMarkerStringAndOneObject() {
  179 + Marker marker = null;
  180 + Object obj = null;
  181 + this.logger.error(marker,"",obj);
  182 + PowerMock.replay(LoggerFactory.class, this.logger);
  183 + this.slf4jLoggerProxy.error(marker,"",obj);
  184 + PowerMock.verify(this.logger);
  185 + }
  186 +
  187 + @Test//13
  188 + public void testErrorWithMarkerStringAndTwoObjects() {
  189 + Marker marker = null;
  190 + Object obj1 = null, obj2 = null;
  191 + this.logger.error(marker,"",obj1,obj2);
  192 + PowerMock.replay(LoggerFactory.class, this.logger);
  193 + this.slf4jLoggerProxy.error(marker,"",obj1,obj2);
  194 + PowerMock.verify(this.logger);
  195 + }
  196 +
  197 + @Test//14
  198 + public void testErrorWithMarkerStringAndObjectArray() {
  199 + Marker marker = null;
  200 + Object[] obj1 = null;
  201 + this.logger.error(marker,"",obj1);
  202 + PowerMock.replay(LoggerFactory.class, this.logger);
  203 + this.slf4jLoggerProxy.error(marker,"",obj1);
  204 + PowerMock.verify(this.logger);
  205 + }
  206 +
  207 + @Test//15
  208 + public void testErrorWithMarkerStringAndThrowable() {
  209 + Marker marker = null;
  210 + Throwable t = null;
  211 + this.logger.error(marker,"",t);
  212 + PowerMock.replay(LoggerFactory.class, this.logger);
  213 + this.slf4jLoggerProxy.error(marker,"",t);
  214 + PowerMock.verify(this.logger);
  215 + }
  216 +
  217 + @Test//16
  218 + public void testErrorWithString() {
  219 + this.logger.error("");
  220 + PowerMock.replay(LoggerFactory.class, this.logger);
  221 + this.slf4jLoggerProxy.error("");
  222 + PowerMock.verify(this.logger);
  223 + }
  224 +
  225 + @Test//17
  226 + public void testErrorWithStringAndOneObject() {
  227 + Object obj = null;
  228 + this.logger.error("",obj);
  229 + PowerMock.replay(LoggerFactory.class, this.logger);
  230 + this.slf4jLoggerProxy.error("",obj);
  231 + PowerMock.verify(this.logger);
  232 + }
  233 +
  234 + @Test//18
  235 + public void testErrorWithStringAndTwoObjects() {
  236 + Object obj1 = null,obj2 = null;
  237 + this.logger.error("",obj1,obj2);
  238 + PowerMock.replay(LoggerFactory.class, this.logger);
  239 + this.slf4jLoggerProxy.error("",obj1,obj2);
  240 + PowerMock.verify(this.logger);
  241 + }
  242 +
  243 + @Test//19
  244 + public void testErrorWithStringAndObjectArray() {
  245 + Object[] obj = null;
  246 + this.logger.error("",obj);
  247 + PowerMock.replay(LoggerFactory.class, this.logger);
  248 + this.slf4jLoggerProxy.error("",obj);
  249 + PowerMock.verify(this.logger);
  250 + }
  251 +
  252 + @Test//20
  253 + public void testErrorWithStringAndThrowable() {
  254 + Throwable t = null;
  255 + this.logger.error("",t);
  256 + PowerMock.replay(LoggerFactory.class, this.logger);
  257 + this.slf4jLoggerProxy.error("",t);
  258 + PowerMock.verify(this.logger);
  259 + }
  260 +
  261 + @Test//21
  262 + public void testGetName() {
  263 + expect(this.logger.getName()).andReturn("xxx");
  264 + PowerMock.replay(LoggerFactory.class, this.logger);
  265 + assertEquals("xxx", this.slf4jLoggerProxy.getName());
  266 + PowerMock.verify(this.logger);
  267 + }
  268 +
  269 + @Test//22
  270 + public void testInfoWithMarkerAndString() {
  271 + Marker marker = null;
  272 + this.logger.info(marker,"");
  273 + PowerMock.replay(LoggerFactory.class, this.logger);
  274 + this.slf4jLoggerProxy.info(marker,"");
  275 + PowerMock.verify(this.logger);
  276 + }
  277 +
  278 + @Test//23
  279 + public void testInfoWithMarkerStringAndOneObject() {
  280 + Marker marker = null;
  281 + Object obj = null;
  282 + this.logger.info(marker,"",obj);
  283 + PowerMock.replay(LoggerFactory.class, this.logger);
  284 + this.slf4jLoggerProxy.info(marker,"",obj);
  285 + PowerMock.verify(this.logger);
  286 + }
  287 +
  288 + @Test//24
  289 + public void testInfoWithMarkerStringAndTwoObjects() {
  290 + Marker marker = null;
  291 + Object obj1 = null, obj2 = null;
  292 + this.logger.info(marker,"",obj1, obj2);
  293 + PowerMock.replay(LoggerFactory.class, this.logger);
  294 + this.slf4jLoggerProxy.info(marker,"",obj1,obj2);
  295 + PowerMock.verify(this.logger);
  296 + }
  297 +
  298 + @Test//25
  299 + public void testInfoWithMarkerStringAndObjectArray() {
  300 + Marker marker = null;
  301 + Object[] obj = null;
  302 + this.logger.info(marker,"",obj);
  303 + PowerMock.replay(LoggerFactory.class, this.logger);
  304 + this.slf4jLoggerProxy.info(marker,"",obj);
  305 + PowerMock.verify(this.logger);
  306 + }
  307 +
  308 + @Test//26
  309 + public void testInfoWithMarkerStringAndThrowable() {
  310 + Marker marker = null;
  311 + Throwable t = null;
  312 + this.logger.info(marker,"",t);
  313 + PowerMock.replay(LoggerFactory.class, this.logger);
  314 + this.slf4jLoggerProxy.info(marker,"",t);
  315 + PowerMock.verify(this.logger);
  316 + }
  317 +
  318 + @Test//27
  319 + public void testInfoWithString() {
  320 + this.logger.info("");
  321 + PowerMock.replay(LoggerFactory.class, this.logger);
  322 + this.slf4jLoggerProxy.info("");
  323 + PowerMock.verify(this.logger);
  324 + }
  325 +
  326 + @Test//28
  327 + public void testInfoWithStringAndOneObject() {
  328 + Object obj = null;
  329 + this.logger.info("",obj);
  330 + PowerMock.replay(LoggerFactory.class, this.logger);
  331 + this.slf4jLoggerProxy.info("",obj);
  332 + PowerMock.verify(this.logger);
  333 + }
  334 +
  335 + @Test//29
  336 + public void testInfoWithStringAndTwoObjects() {
  337 + Object obj1 = null, obj2 = null;
  338 + this.logger.info("",obj1,obj2);
  339 + PowerMock.replay(LoggerFactory.class, this.logger);
  340 + this.slf4jLoggerProxy.info("",obj1,obj2);
  341 + PowerMock.verify(this.logger);
  342 + }
  343 +
  344 + @Test//30
  345 + public void testInfoWithStringAndObjectArray() {
  346 + Object[] obj = null;
  347 + this.logger.info("",obj);
  348 + PowerMock.replay(LoggerFactory.class, this.logger);
  349 + this.slf4jLoggerProxy.info("",obj);
  350 + PowerMock.verify(this.logger);
  351 + }
  352 +
  353 + @Test//31
  354 + public void testInfoWithStringAndThrowable() {
  355 + Throwable t = null;
  356 + this.logger.info("",t);
  357 + PowerMock.replay(LoggerFactory.class, this.logger);
  358 + this.slf4jLoggerProxy.info("",t);
  359 + PowerMock.verify(this.logger);
  360 + }
  361 +
  362 + @Test//32
  363 + public void testIsDebugEnabled() {
  364 + expect(this.logger.isDebugEnabled()).andReturn(true);
  365 + PowerMock.replay(LoggerFactory.class, this.logger);
  366 + assertEquals(true, this.slf4jLoggerProxy.isDebugEnabled());
  367 + PowerMock.verify(this.logger);
  368 + }
  369 +
  370 + @Test//33
  371 + public void testIsDebugEnabledWithMarker() {
  372 + Marker marker = null;
  373 + expect(this.logger.isDebugEnabled(marker)).andReturn(true);
  374 + PowerMock.replay(LoggerFactory.class, this.logger);
  375 + assertEquals(true, this.slf4jLoggerProxy.isDebugEnabled(marker));
  376 + PowerMock.verify(this.logger);
  377 + }
  378 +
  379 + @Test//34
  380 + public void testIsErrorEnabled() {
  381 + expect(this.logger.isErrorEnabled()).andReturn(true);
  382 + PowerMock.replay(LoggerFactory.class, this.logger);
  383 + assertEquals(true, this.slf4jLoggerProxy.isErrorEnabled());
  384 + PowerMock.verify(this.logger);
  385 + }
  386 +
  387 + @Test//35
  388 + public void testIsErrorEnabledWithMarker() {
  389 + Marker marker = null;
  390 + expect(this.logger.isErrorEnabled(marker)).andReturn(true);
  391 + PowerMock.replay(LoggerFactory.class, this.logger);
  392 + assertEquals(true, this.slf4jLoggerProxy.isErrorEnabled(marker));
  393 + PowerMock.verify(this.logger);
  394 + }
  395 +
  396 + @Test//36
  397 + public void testIsInfoEnabled() {
  398 + expect(this.logger.isInfoEnabled()).andReturn(true);
  399 + PowerMock.replay(LoggerFactory.class, this.logger);
  400 + assertEquals(true, this.slf4jLoggerProxy.isInfoEnabled());
  401 + PowerMock.verify(this.logger);
  402 + }
  403 +
  404 + @Test//37
  405 + public void testIsInfoEnabledWithMarker() {
  406 + Marker marker = null;
  407 + expect(this.logger.isInfoEnabled(marker)).andReturn(true);
  408 + PowerMock.replay(LoggerFactory.class, this.logger);
  409 + assertEquals(true, this.slf4jLoggerProxy.isInfoEnabled(marker));
  410 + PowerMock.verify(this.logger);
  411 + }
  412 +
  413 + @Test//38
  414 + public void testIsTRaceEnabled() {
  415 + expect(this.logger.isTraceEnabled()).andReturn(true);
  416 + PowerMock.replay(LoggerFactory.class, this.logger);
  417 + assertEquals(true, this.slf4jLoggerProxy.isTraceEnabled());
  418 + PowerMock.verify(this.logger);
  419 + }
  420 +
  421 + @Test//39
  422 + public void testIsTraceEnabledWithMarker() {
  423 + Marker marker = null;
  424 + expect(this.logger.isTraceEnabled(marker)).andReturn(true);
  425 + PowerMock.replay(LoggerFactory.class, this.logger);
  426 + assertEquals(true, this.slf4jLoggerProxy.isTraceEnabled(marker));
  427 + PowerMock.verify(this.logger);
  428 + }
  429 +
  430 + @Test//40
  431 + public void testIsWarnEnabled() {
  432 + expect(this.logger.isWarnEnabled()).andReturn(true);
  433 + PowerMock.replay(LoggerFactory.class, this.logger);
  434 + assertEquals(true, this.slf4jLoggerProxy.isWarnEnabled());
  435 + PowerMock.verify(this.logger);
  436 + }
  437 +
  438 + @Test//41
  439 + public void testIsWarnEnabledWithMarker() {
  440 + Marker marker = null;
  441 + expect(this.logger.isWarnEnabled(marker)).andReturn(true);
  442 + PowerMock.replay(LoggerFactory.class, this.logger);
  443 + assertEquals(true, this.slf4jLoggerProxy.isWarnEnabled(marker));
  444 + PowerMock.verify(this.logger);
  445 + }
  446 +
  447 + @Test//42
  448 + public void testTraceWithMarkerAndString() {
  449 + Marker marker = null;
  450 + this.logger.trace(marker,"");
  451 + PowerMock.replay(LoggerFactory.class, this.logger);
  452 + this.slf4jLoggerProxy.trace(marker,"");
  453 + PowerMock.verify(this.logger);
  454 + }
  455 +
  456 + @Test//43
  457 + public void testTraceWithMarkerStringAndOneObject() {
  458 + Marker marker = null;
  459 + Object obj = null;
  460 + this.logger.trace(marker,"",obj);
  461 + PowerMock.replay(LoggerFactory.class, this.logger);
  462 + this.slf4jLoggerProxy.trace(marker,"",obj);
  463 + PowerMock.verify(this.logger);
  464 + }
  465 +
  466 + @Test//44
  467 + public void testTraceWithMarkerStringAndTwoObjects() {
  468 + Marker marker = null;
  469 + Object obj1 = null, obj2 = null;
  470 + this.logger.trace(marker,"",obj1, obj2);
  471 + PowerMock.replay(LoggerFactory.class, this.logger);
  472 + this.slf4jLoggerProxy.trace(marker,"",obj1,obj2);
  473 + PowerMock.verify(this.logger);
  474 + }
  475 +
  476 + @Test//45
  477 + public void testTraceWithMarkerStringAndObjectArray() {
  478 + Marker marker = null;
  479 + Object[] obj = null;
  480 + this.logger.trace(marker,"",obj);
  481 + PowerMock.replay(LoggerFactory.class, this.logger);
  482 + this.slf4jLoggerProxy.trace(marker,"",obj);
  483 + PowerMock.verify(this.logger);
  484 + }
  485 +
  486 + @Test//46
  487 + public void testTraceWithMarkerStringAndThrowable() {
  488 + Marker marker = null;
  489 + Throwable t = null;
  490 + this.logger.trace(marker,"",t);
  491 + PowerMock.replay(LoggerFactory.class, this.logger);
  492 + this.slf4jLoggerProxy.trace(marker,"",t);
  493 + PowerMock.verify(this.logger);
  494 + }
  495 +
  496 + @Test//47
  497 + public void testTraceWithString() {
  498 + this.logger.trace("");
  499 + PowerMock.replay(LoggerFactory.class, this.logger);
  500 + this.slf4jLoggerProxy.trace("");
  501 + PowerMock.verify(this.logger);
  502 + }
  503 +
  504 + @Test//48
  505 + public void testTraceWithStringAndOneObject() {
  506 + Object obj = null;
  507 + this.logger.trace("",obj);
  508 + PowerMock.replay(LoggerFactory.class, this.logger);
  509 + this.slf4jLoggerProxy.trace("",obj);
  510 + PowerMock.verify(this.logger);
  511 + }
  512 +
  513 + @Test//49
  514 + public void testTraceWithStringAndTwoObjects() {
  515 + Object obj1 = null, obj2 = null;
  516 + this.logger.trace("",obj1,obj2);
  517 + PowerMock.replay(LoggerFactory.class, this.logger);
  518 + this.slf4jLoggerProxy.trace("",obj1,obj2);
  519 + PowerMock.verify(this.logger);
  520 + }
  521 +
  522 + @Test//50
  523 + public void testTraceWithStringAndObjectArray() {
  524 + Object[] obj = null;
  525 + this.logger.trace("",obj);
  526 + PowerMock.replay(LoggerFactory.class, this.logger);
  527 + this.slf4jLoggerProxy.trace("",obj);
  528 + PowerMock.verify(this.logger);
  529 + }
  530 +
  531 + @Test//51
  532 + public void testTraceWithStringAndThrowable() {
  533 + Throwable t = null;
  534 + this.logger.trace("",t);
  535 + PowerMock.replay(LoggerFactory.class, this.logger);
  536 + this.slf4jLoggerProxy.trace("",t);
  537 + PowerMock.verify(this.logger);
  538 + }
  539 +
  540 + @Test//52
  541 + public void testWarnWithMarkerAndString() {
  542 + Marker marker = null;
  543 + this.logger.warn(marker,"");
  544 + PowerMock.replay(LoggerFactory.class, this.logger);
  545 + this.slf4jLoggerProxy.warn(marker,"");
  546 + PowerMock.verify(this.logger);
  547 + }
  548 +
  549 + @Test//53
  550 + public void testWarnWithMarkerStringAndOneObject() {
  551 + Marker marker = null;
  552 + Object obj = null;
  553 + this.logger.warn(marker,"",obj);
  554 + PowerMock.replay(LoggerFactory.class, this.logger);
  555 + this.slf4jLoggerProxy.warn(marker,"",obj);
  556 + PowerMock.verify(this.logger);
  557 + }
  558 +
  559 + @Test//54
  560 + public void testWarnWithMarkerStringAndTwoObjects() {
  561 + Marker marker = null;
  562 + Object obj1 = null, obj2 = null;
  563 + this.logger.warn(marker,"",obj1, obj2);
  564 + PowerMock.replay(LoggerFactory.class, this.logger);
  565 + this.slf4jLoggerProxy.warn(marker,"",obj1,obj2);
  566 + PowerMock.verify(this.logger);
  567 + }
  568 +
  569 + @Test//55
  570 + public void testWarnWithMarkerStringAndObjectArray() {
  571 + Marker marker = null;
  572 + Object[] obj = null;
  573 + this.logger.warn(marker,"",obj);
  574 + PowerMock.replay(LoggerFactory.class, this.logger);
  575 + this.slf4jLoggerProxy.warn(marker,"",obj);
  576 + PowerMock.verify(this.logger);
  577 + }
  578 +
  579 + @Test//56
  580 + public void testWarnWithMarkerStringAndThrowable() {
  581 + Marker marker = null;
  582 + Throwable t = null;
  583 + this.logger.warn(marker,"",t);
  584 + PowerMock.replay(LoggerFactory.class, this.logger);
  585 + this.slf4jLoggerProxy.warn(marker,"",t);
  586 + PowerMock.verify(this.logger);
  587 + }
  588 +
  589 + @Test//57
  590 + public void testWarnWithString() {
  591 + this.logger.warn("");
  592 + PowerMock.replay(LoggerFactory.class, this.logger);
  593 + this.slf4jLoggerProxy.warn("");
  594 + PowerMock.verify(this.logger);
  595 + }
  596 +
  597 + @Test//58
  598 + public void testWarnWithStringAndOneObject() {
  599 + Object obj = null;
  600 + this.logger.warn("",obj);
  601 + PowerMock.replay(LoggerFactory.class, this.logger);
  602 + this.slf4jLoggerProxy.warn("",obj);
  603 + PowerMock.verify(this.logger);
  604 + }
  605 +
  606 + @Test//59
  607 + public void testWarnWithStringAndTwoObjects() {
  608 + Object obj1 = null, obj2 = null;
  609 + this.logger.warn("",obj1,obj2);
  610 + PowerMock.replay(LoggerFactory.class, this.logger);
  611 + this.slf4jLoggerProxy.warn("",obj1,obj2);
  612 + PowerMock.verify(this.logger);
  613 + }
  614 +
  615 + @Test//60
  616 + public void testWarnWithStringAndObjectArray() {
  617 + Object[] obj = null;
  618 + this.logger.warn("",obj);
  619 + PowerMock.replay(LoggerFactory.class, this.logger);
  620 + this.slf4jLoggerProxy.warn("",obj);
  621 + PowerMock.verify(this.logger);
  622 + }
  623 +
  624 + @Test//61
  625 + public void testWarnWithStringAndThrowable() {
  626 + Throwable t = null;
  627 + this.logger.warn("",t);
  628 + PowerMock.replay(LoggerFactory.class, this.logger);
  629 + this.slf4jLoggerProxy.warn("",t);
  630 + PowerMock.verify(this.logger);
  631 + }
  632 +}
impl/core/src/test/resources/demoiselle.properties
@@ -75,4 +75,7 @@ convention_underline=Convention Underline @@ -75,4 +75,7 @@ convention_underline=Convention Underline
75 convention.dot=Convention Dot 75 convention.dot=Convention Dot
76 conventionalllowercase=All LowerCase 76 conventionalllowercase=All LowerCase
77 CONVENTIONALLUPPERCASE=ALL UPPERCASE 77 CONVENTIONALLUPPERCASE=ALL UPPERCASE
78 -complexObject=null  
79 \ No newline at end of file 78 \ No newline at end of file
  79 +complexObject=null
  80 +properties.1=teste1
  81 +properties.2=teste2
  82 +classe=br.gov.frameworkdemoiselle.internal.configuration.ConfigurationLoaderTest
80 \ No newline at end of file 83 \ No newline at end of file