Commit d5646790b91a33931de66230d101a546b8c16e47
1 parent
0f297055
Exists in
master
Correção de testes.
Showing
2 changed files
with
22 additions
and
44 deletions
Show diff stats
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 | package br.gov.frameworkdemoiselle.message; | 19 | package br.gov.frameworkdemoiselle.message; |
| 38 | 20 | ||
| @@ -45,12 +27,10 @@ import static org.powermock.api.easymock.PowerMock.replayAll; | @@ -45,12 +27,10 @@ import static org.powermock.api.easymock.PowerMock.replayAll; | ||
| 45 | import static org.powermock.api.easymock.PowerMock.verifyAll; | 27 | import static org.powermock.api.easymock.PowerMock.verifyAll; |
| 46 | 28 | ||
| 47 | import java.util.Arrays; | 29 | import java.util.Arrays; |
| 48 | -import java.util.ResourceBundle; | ||
| 49 | 30 | ||
| 50 | import org.easymock.EasyMock; | 31 | import org.easymock.EasyMock; |
| 51 | import org.junit.After; | 32 | import org.junit.After; |
| 52 | import org.junit.Before; | 33 | import org.junit.Before; |
| 53 | -import org.junit.Ignore; | ||
| 54 | import org.junit.Test; | 34 | import org.junit.Test; |
| 55 | import org.junit.runner.RunWith; | 35 | import org.junit.runner.RunWith; |
| 56 | import org.powermock.api.easymock.PowerMock; | 36 | import org.powermock.api.easymock.PowerMock; |
| @@ -58,9 +38,9 @@ import org.powermock.core.classloader.annotations.PrepareForTest; | @@ -58,9 +38,9 @@ import org.powermock.core.classloader.annotations.PrepareForTest; | ||
| 58 | import org.powermock.modules.junit4.PowerMockRunner; | 38 | import org.powermock.modules.junit4.PowerMockRunner; |
| 59 | 39 | ||
| 60 | import br.gov.frameworkdemoiselle.util.Beans; | 40 | import br.gov.frameworkdemoiselle.util.Beans; |
| 41 | +import br.gov.frameworkdemoiselle.util.ResourceBundle; | ||
| 61 | import br.gov.frameworkdemoiselle.util.Strings; | 42 | import br.gov.frameworkdemoiselle.util.Strings; |
| 62 | 43 | ||
| 63 | -@Ignore | ||
| 64 | @RunWith(PowerMockRunner.class) | 44 | @RunWith(PowerMockRunner.class) |
| 65 | @PrepareForTest({ Beans.class, ResourceBundle.class }) | 45 | @PrepareForTest({ Beans.class, ResourceBundle.class }) |
| 66 | public class DefaultMessageTest { | 46 | public class DefaultMessageTest { |
| @@ -156,8 +136,8 @@ public class DefaultMessageTest { | @@ -156,8 +136,8 @@ public class DefaultMessageTest { | ||
| 156 | 136 | ||
| 157 | text = "text"; | 137 | text = "text"; |
| 158 | message = new DefaultMessage(text); | 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 | text = MOCK_RESOURCE_BUNDLE_KEY; | 142 | text = MOCK_RESOURCE_BUNDLE_KEY; |
| 163 | params = new Object[] { "1", "2" }; | 143 | params = new Object[] { "1", "2" }; |
| @@ -165,7 +145,7 @@ public class DefaultMessageTest { | @@ -165,7 +145,7 @@ public class DefaultMessageTest { | ||
| 165 | assertEquals( | 145 | assertEquals( |
| 166 | "DefaultMessage [originalText=" + text + ", parsedText=" | 146 | "DefaultMessage [originalText=" + text + ", parsedText=" |
| 167 | + Strings.getString(bundle.getString(text), params) + ", severity=FATAL, params=" | 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 | @Test | 151 | @Test |
impl/core/src/test/java/br/gov/frameworkdemoiselle/util/BeansTest.java
| @@ -71,7 +71,6 @@ public class BeansTest { | @@ -71,7 +71,6 @@ public class BeansTest { | ||
| 71 | 71 | ||
| 72 | String object = "object"; | 72 | String object = "object"; |
| 73 | 73 | ||
| 74 | - expect(bean.getBeanClass()).andReturn(null); | ||
| 75 | expect(beanManager.createCreationalContext(EasyMock.anyObject(Contextual.class))).andReturn(null); | 74 | expect(beanManager.createCreationalContext(EasyMock.anyObject(Contextual.class))).andReturn(null); |
| 76 | expect(beanManager.getBeans(EasyMock.anyObject(Class.class))).andReturn(collection); | 75 | expect(beanManager.getBeans(EasyMock.anyObject(Class.class))).andReturn(collection); |
| 77 | expect( | 76 | expect( |
| @@ -80,7 +79,7 @@ public class BeansTest { | @@ -80,7 +79,7 @@ public class BeansTest { | ||
| 80 | 79 | ||
| 81 | replayAll(beanManager, bean); | 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 | Beans beans = new Beans(); | 83 | Beans beans = new Beans(); |
| 85 | beans.setBeanManager(beanManager); | 84 | beans.setBeanManager(beanManager); |
| 86 | String returned = beans.getReference(String.class); | 85 | String returned = beans.getReference(String.class); |
| @@ -111,7 +110,7 @@ public class BeansTest { | @@ -111,7 +110,7 @@ public class BeansTest { | ||
| 111 | 110 | ||
| 112 | replayAll(beanManager, bean); | 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 | Beans beans = new Beans(); | 114 | Beans beans = new Beans(); |
| 116 | beans.setBeanManager(beanManager); | 115 | beans.setBeanManager(beanManager); |
| 117 | String returned = beans.getReference("something"); | 116 | String returned = beans.getReference("something"); |
| @@ -121,5 +120,4 @@ public class BeansTest { | @@ -121,5 +120,4 @@ public class BeansTest { | ||
| 121 | 120 | ||
| 122 | verifyAll(); | 121 | verifyAll(); |
| 123 | } | 122 | } |
| 124 | - | ||
| 125 | } | 123 | } |