Commit d5646790b91a33931de66230d101a546b8c16e47

Authored by Wilson Guimarães
1 parent 0f297055
Exists in master

Correção de testes.

impl/core/src/test/java/br/gov/frameworkdemoiselle/message/DefaultMessageTest.java
1 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.
  2 + * Demoiselle Framework Copyright (C) 2010 SERPRO
  3 + * ---------------------------------------------------------------------------- This file is part of Demoiselle
  4 + * Framework. Demoiselle Framework is free software; you can redistribute it and/or modify it under the terms of the GNU
  5 + * Lesser General Public License version 3 as published by the Free Software Foundation. This program is distributed in
  6 + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  7 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a
  8 + * copy of the GNU Lesser General Public License version 3 along with this program; if not, see
  9 + * <http://www.gnu.org/licenses/> or write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  10 + * Boston, MA 02110-1301, USA. ---------------------------------------------------------------------------- Este arquivo
  11 + * é parte do Framework Demoiselle. O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  12 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação do Software Livre (FSF). Este
  13 + * programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma garantia implícita de
  14 + * ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português para
  15 + * maiores detalhes. Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título "LICENCA.txt", junto com esse
  16 + * programa. Se não, acesse <http://www.gnu.org/licenses/> ou escreva para a Fundação do Software Livre (FSF) Inc., 51
  17 + * Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36 18 */
37 19 package br.gov.frameworkdemoiselle.message;
38 20  
... ... @@ -45,12 +27,10 @@ import static org.powermock.api.easymock.PowerMock.replayAll;
45 27 import static org.powermock.api.easymock.PowerMock.verifyAll;
46 28  
47 29 import java.util.Arrays;
48   -import java.util.ResourceBundle;
49 30  
50 31 import org.easymock.EasyMock;
51 32 import org.junit.After;
52 33 import org.junit.Before;
53   -import org.junit.Ignore;
54 34 import org.junit.Test;
55 35 import org.junit.runner.RunWith;
56 36 import org.powermock.api.easymock.PowerMock;
... ... @@ -58,9 +38,9 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
58 38 import org.powermock.modules.junit4.PowerMockRunner;
59 39  
60 40 import br.gov.frameworkdemoiselle.util.Beans;
  41 +import br.gov.frameworkdemoiselle.util.ResourceBundle;
61 42 import br.gov.frameworkdemoiselle.util.Strings;
62 43  
63   -@Ignore
64 44 @RunWith(PowerMockRunner.class)
65 45 @PrepareForTest({ Beans.class, ResourceBundle.class })
66 46 public class DefaultMessageTest {
... ... @@ -156,8 +136,8 @@ public class DefaultMessageTest {
156 136  
157 137 text = "text";
158 138 message = new DefaultMessage(text);
159   - assertEquals("DefaultMessage [originalText=" + text + ", parsedText=" + text + ", severity=INFO, params=[]]",
160   - message.toString());
  139 + assertEquals("DefaultMessage [originalText=" + text + ", parsedText=" + text
  140 + + ", severity=INFO, params=[], bundle=" + bundle.toString() + "]", message.toString());
161 141  
162 142 text = MOCK_RESOURCE_BUNDLE_KEY;
163 143 params = new Object[] { "1", "2" };
... ... @@ -165,7 +145,7 @@ public class DefaultMessageTest {
165 145 assertEquals(
166 146 "DefaultMessage [originalText=" + text + ", parsedText="
167 147 + Strings.getString(bundle.getString(text), params) + ", severity=FATAL, params="
168   - + Arrays.toString(params) + "]", message.toString());
  148 + + Arrays.toString(params) + ", bundle=" + bundle.toString() + "]", message.toString());
169 149 }
170 150  
171 151 @Test
... ...
impl/core/src/test/java/br/gov/frameworkdemoiselle/util/BeansTest.java
... ... @@ -71,7 +71,6 @@ public class BeansTest {
71 71  
72 72 String object = "object";
73 73  
74   - expect(bean.getBeanClass()).andReturn(null);
75 74 expect(beanManager.createCreationalContext(EasyMock.anyObject(Contextual.class))).andReturn(null);
76 75 expect(beanManager.getBeans(EasyMock.anyObject(Class.class))).andReturn(collection);
77 76 expect(
... ... @@ -80,7 +79,7 @@ public class BeansTest {
80 79  
81 80 replayAll(beanManager, bean);
82 81  
83   - // We don't need to instantiate utility classes. But if we don't get in this way, we'll not get 100% cobertura.
  82 + // There is no need to instantiate utility classes. But it's the only way to get 100% cobertura.
84 83 Beans beans = new Beans();
85 84 beans.setBeanManager(beanManager);
86 85 String returned = beans.getReference(String.class);
... ... @@ -111,7 +110,7 @@ public class BeansTest {
111 110  
112 111 replayAll(beanManager, bean);
113 112  
114   - // We don't need to instantiate utility classes. But if we don't get in this way, we'll not get 100% cobertura.
  113 + // There is no need to instantiate utility classes. But it's the only way to get 100% cobertura.
115 114 Beans beans = new Beans();
116 115 beans.setBeanManager(beanManager);
117 116 String returned = beans.getReference("something");
... ... @@ -121,5 +120,4 @@ public class BeansTest {
121 120  
122 121 verifyAll();
123 122 }
124   -
125 123 }
... ...