Commit 0d972391fccf5d9823a9f993092d6f82d2d32408
1 parent
93b74e51
Exists in
master
REOPENED - issue FWK-97: Seleção do producer em Beans.getReference() é
aleatória https://demoiselle.atlassian.net/browse/FWK-97
Showing
31 changed files
with
1010 additions
and
951 deletions
Show diff stats
impl/core/src/test/java/management/testclasses/DummyNotificationListener.java
| ... | ... | @@ -46,7 +46,7 @@ import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; |
| 46 | 46 | import br.gov.frameworkdemoiselle.management.NotificationManager; |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * Dummy class to test receiving of notifications sent by the {@link NotificationManager} | |
| 49 | + * Bean class to test receiving of notifications sent by the {@link NotificationManager} | |
| 50 | 50 | * |
| 51 | 51 | * @author SERPRO |
| 52 | 52 | * | ... | ... |
impl/core/src/test/java/management/testclasses/ManagedClassStore.java
| ... | ... | @@ -47,7 +47,7 @@ import br.gov.frameworkdemoiselle.internal.implementation.Management; |
| 47 | 47 | import br.gov.frameworkdemoiselle.util.Beans; |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * Dummy class that stores managed types detected by the management bootstrap | |
| 50 | + * Bean class that stores managed types detected by the management bootstrap | |
| 51 | 51 | * and can read/write properties and invoke operations on them, simulating a management |
| 52 | 52 | * extension like JMX or SNMP. |
| 53 | 53 | * | ... | ... |
impl/core/src/test/java/util/ExceptionsTest.java
| ... | ... | @@ -1,90 +0,0 @@ |
| 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 util; | |
| 38 | - | |
| 39 | -import static org.junit.Assert.assertFalse; | |
| 40 | -import static org.junit.Assert.assertTrue; | |
| 41 | -import static org.junit.Assert.fail; | |
| 42 | - | |
| 43 | -import org.junit.Test; | |
| 44 | - | |
| 45 | -import br.gov.frameworkdemoiselle.exception.ApplicationException; | |
| 46 | -import br.gov.frameworkdemoiselle.util.Exceptions; | |
| 47 | - | |
| 48 | -public class ExceptionsTest { | |
| 49 | - | |
| 50 | - @Test | |
| 51 | - public void testIsApplicationException() { | |
| 52 | - assertTrue(Exceptions.isApplicationException(new MyException())); | |
| 53 | - assertFalse(Exceptions.isApplicationException(new Exception())); | |
| 54 | - } | |
| 55 | - | |
| 56 | - @Test | |
| 57 | - public void testHandleRuntimeException() { | |
| 58 | - try { | |
| 59 | - Exceptions.handleToRuntimeException(new SomeRuntimeException()); | |
| 60 | - fail(); | |
| 61 | - } catch (Throwable t) { | |
| 62 | - if (!RuntimeException.class.isInstance(t)) { | |
| 63 | - fail(); | |
| 64 | - } | |
| 65 | - } | |
| 66 | - | |
| 67 | - try { | |
| 68 | - Exceptions.handleToRuntimeException(new Exception()); | |
| 69 | - fail(); | |
| 70 | - } catch (Throwable t) { | |
| 71 | - if (!RuntimeException.class.isInstance(t)) { | |
| 72 | - fail(); | |
| 73 | - } | |
| 74 | - } | |
| 75 | - | |
| 76 | - } | |
| 77 | - | |
| 78 | -} | |
| 79 | - | |
| 80 | -@ApplicationException | |
| 81 | -class MyException extends Exception { | |
| 82 | - | |
| 83 | - private static final long serialVersionUID = 1L; | |
| 84 | -} | |
| 85 | - | |
| 86 | -class SomeRuntimeException extends RuntimeException { | |
| 87 | - | |
| 88 | - private static final long serialVersionUID = 1L; | |
| 89 | - | |
| 90 | -} |
impl/core/src/test/java/util/ReflectionsTest.java
| ... | ... | @@ -1,75 +0,0 @@ |
| 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 util; | |
| 38 | - | |
| 39 | -import static org.junit.Assert.assertEquals; | |
| 40 | - | |
| 41 | -import java.lang.reflect.Member; | |
| 42 | - | |
| 43 | -import org.junit.Test; | |
| 44 | - | |
| 45 | -import br.gov.frameworkdemoiselle.util.Reflections; | |
| 46 | - | |
| 47 | -public class ReflectionsTest { | |
| 48 | - | |
| 49 | - @Test | |
| 50 | - public void testGetGenericTypeArgumentClass() { | |
| 51 | - assertEquals(Long.class, Reflections.getGenericTypeArgument(OtherClass.class, 0)); | |
| 52 | - assertEquals(String.class, Reflections.getGenericTypeArgument(OtherClass.class, 1)); | |
| 53 | - } | |
| 54 | - | |
| 55 | - @Test | |
| 56 | - public void testGetGenericTypeArgumentMember() throws SecurityException, NoSuchFieldException { | |
| 57 | - Member[] members = OtherClass.class.getFields(); | |
| 58 | - assertEquals(Long.class, Reflections.getGenericTypeArgument(members[0], 0)); | |
| 59 | - assertEquals(String.class, Reflections.getGenericTypeArgument(members[1], 0)); | |
| 60 | - } | |
| 61 | -} | |
| 62 | - | |
| 63 | -class SomeClass<T, I> { | |
| 64 | - | |
| 65 | - public void setNumber(final T t) { | |
| 66 | - | |
| 67 | - } | |
| 68 | -} | |
| 69 | - | |
| 70 | -class OtherClass extends SomeClass<Long, String> { | |
| 71 | - | |
| 72 | - public Class<Long> number; | |
| 73 | - | |
| 74 | - public Class<String> text; | |
| 75 | -} |
impl/core/src/test/java/util/ResourceBundleTest.java
| ... | ... | @@ -1,66 +0,0 @@ |
| 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 util; | |
| 38 | - | |
| 39 | -import static org.junit.Assert.assertEquals; | |
| 40 | - | |
| 41 | -import java.util.Locale; | |
| 42 | - | |
| 43 | -import org.junit.Before; | |
| 44 | -import org.junit.Test; | |
| 45 | - | |
| 46 | -import br.gov.frameworkdemoiselle.util.ResourceBundle; | |
| 47 | - | |
| 48 | -public class ResourceBundleTest { | |
| 49 | - | |
| 50 | - private ResourceBundle resourceBundle; | |
| 51 | - | |
| 52 | - @Before | |
| 53 | - public void setUp() throws Exception { | |
| 54 | - resourceBundle = new ResourceBundle("resourcebundle/resource-bundle", new Locale("pt")); | |
| 55 | - } | |
| 56 | - | |
| 57 | - @Test | |
| 58 | - public void getString() { | |
| 59 | - assertEquals("no params", resourceBundle.getString("msgWithoutParams")); | |
| 60 | - | |
| 61 | - assertEquals("params: a, b", resourceBundle.getString("msgWithParams", "a", "b")); | |
| 62 | - | |
| 63 | - assertEquals("params: {0}, {1}", resourceBundle.getString("msgWithParams")); | |
| 64 | - } | |
| 65 | - | |
| 66 | -} |
impl/core/src/test/java/util/StringsTest.java
| ... | ... | @@ -1,202 +0,0 @@ |
| 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 util; | |
| 38 | - | |
| 39 | -import static org.junit.Assert.assertEquals; | |
| 40 | -import static org.junit.Assert.assertFalse; | |
| 41 | -import static org.junit.Assert.assertNull; | |
| 42 | -import static org.junit.Assert.assertTrue; | |
| 43 | - | |
| 44 | -import org.junit.Test; | |
| 45 | - | |
| 46 | -import br.gov.frameworkdemoiselle.annotation.Ignore; | |
| 47 | -import br.gov.frameworkdemoiselle.util.Strings; | |
| 48 | - | |
| 49 | -public class StringsTest { | |
| 50 | - | |
| 51 | - @Test | |
| 52 | - public void getString() { | |
| 53 | - testEqualsGetString("teste", "teste"); | |
| 54 | - testEqualsGetString("", ""); | |
| 55 | - testEqualsGetString(null, null); | |
| 56 | - testEqualsGetString(null, null, "teste"); | |
| 57 | - testEqualsGetString("{0}", "teste", "teste"); | |
| 58 | - testEqualsGetString("teste", "teste", (Object[]) null); | |
| 59 | - testEqualsGetString("teste {0}", "teste 1", "1"); | |
| 60 | - testEqualsGetString("{0} teste", "Um teste", "Um"); | |
| 61 | - testEqualsGetString("{1} testando {0}", "Apenas testando novamente", "novamente", "Apenas"); | |
| 62 | - testEqualsGetString("{0} testando {1}", "Apenas testando {1}", "Apenas", null); | |
| 63 | - testEqualsGetString("testando {1} novamente", "testando isto novamente", "aquilo", "isto"); | |
| 64 | - testEqualsGetString("teste", "teste", "1", "2"); | |
| 65 | - testEqualsGetString("teste {0}.", "teste \\.", "\\"); | |
| 66 | - } | |
| 67 | - | |
| 68 | - @Test | |
| 69 | - public void isEmpty() { | |
| 70 | - assertTrue(Strings.isEmpty(null)); | |
| 71 | - assertTrue(Strings.isEmpty("")); | |
| 72 | - assertTrue(Strings.isEmpty(" ")); | |
| 73 | - assertTrue(Strings.isEmpty(" ")); | |
| 74 | - | |
| 75 | - assertFalse(Strings.isEmpty(" _ ")); | |
| 76 | - assertFalse(Strings.isEmpty(".")); | |
| 77 | - assertFalse(Strings.isEmpty("null")); | |
| 78 | - } | |
| 79 | - | |
| 80 | - @Test | |
| 81 | - public void isResourceBundleKeyFormat() { | |
| 82 | - assertTrue(Strings.isResourceBundleKeyFormat("{x}")); | |
| 83 | - assertTrue(Strings.isResourceBundleKeyFormat("{.}")); | |
| 84 | - assertTrue(Strings.isResourceBundleKeyFormat("{*}")); | |
| 85 | - assertTrue(Strings.isResourceBundleKeyFormat("{$}")); | |
| 86 | - assertFalse(Strings.isResourceBundleKeyFormat("{}")); | |
| 87 | - assertFalse(Strings.isResourceBundleKeyFormat("")); | |
| 88 | - assertFalse(Strings.isResourceBundleKeyFormat(" ")); | |
| 89 | - assertFalse(Strings.isResourceBundleKeyFormat(null)); | |
| 90 | - assertFalse(Strings.isResourceBundleKeyFormat("a{a}a")); | |
| 91 | - assertFalse(Strings.isResourceBundleKeyFormat("a{a}")); | |
| 92 | - assertFalse(Strings.isResourceBundleKeyFormat("{a}a")); | |
| 93 | - assertFalse(Strings.isResourceBundleKeyFormat(" {a} ")); | |
| 94 | - assertFalse(Strings.isResourceBundleKeyFormat("{a")); | |
| 95 | - assertFalse(Strings.isResourceBundleKeyFormat("a}")); | |
| 96 | - } | |
| 97 | - | |
| 98 | - @Test | |
| 99 | - public void camelCaseToSymbolSeparated() { | |
| 100 | - assertEquals(null, Strings.camelCaseToSymbolSeparated(null, null)); | |
| 101 | - assertEquals(null, Strings.camelCaseToSymbolSeparated(null, ".")); | |
| 102 | - assertEquals("myvar", Strings.camelCaseToSymbolSeparated("myVar", null)); | |
| 103 | - assertEquals("myvar", Strings.camelCaseToSymbolSeparated("myVar", "")); | |
| 104 | - assertEquals("my.var", Strings.camelCaseToSymbolSeparated("myVar", ".")); | |
| 105 | - assertEquals("my-var", Strings.camelCaseToSymbolSeparated("MyVar", "-")); | |
| 106 | - assertEquals("my?var?name", Strings.camelCaseToSymbolSeparated("myVarName", "?")); | |
| 107 | - assertEquals("my___var___name", Strings.camelCaseToSymbolSeparated("myVarName", "___")); | |
| 108 | - } | |
| 109 | - | |
| 110 | - @Test | |
| 111 | - public void firstToUpper() { | |
| 112 | - assertNull(Strings.firstToUpper(null)); | |
| 113 | - assertEquals("", Strings.firstToUpper("")); | |
| 114 | - assertEquals("A", Strings.firstToUpper("a")); | |
| 115 | - assertEquals("A", Strings.firstToUpper("A")); | |
| 116 | - assertEquals("Ab", Strings.firstToUpper("Ab")); | |
| 117 | - assertEquals("AB", Strings.firstToUpper("AB")); | |
| 118 | - assertEquals("Ab", Strings.firstToUpper("ab")); | |
| 119 | - assertEquals("AB", Strings.firstToUpper("aB")); | |
| 120 | - } | |
| 121 | - | |
| 122 | - @Test | |
| 123 | - public void toStringWhenObjectIsNull() { | |
| 124 | - assertEquals("", Strings.toString(null)); | |
| 125 | - } | |
| 126 | - | |
| 127 | - @Test | |
| 128 | - public void classToString() throws SecurityException, NoSuchFieldException { | |
| 129 | - @SuppressWarnings("unused") | |
| 130 | - class Test { | |
| 131 | - | |
| 132 | - private String name = "myName"; | |
| 133 | - | |
| 134 | - private String lastname = "myLastname"; | |
| 135 | - | |
| 136 | - private String nullField = null; | |
| 137 | - | |
| 138 | - @Ignore | |
| 139 | - private String ignore = "ignoreMe"; | |
| 140 | - | |
| 141 | - } | |
| 142 | - | |
| 143 | - String result = Strings.toString(new Test()); | |
| 144 | - assertTrue(result.contains("Test [name=myName, lastname=myLastname, nullField=null, this")); | |
| 145 | - } | |
| 146 | - | |
| 147 | - private void testEqualsGetString(final String in, final String expected, final Object... params) { | |
| 148 | - String out = Strings.getString(in, params); | |
| 149 | - assertEquals(expected, out); | |
| 150 | - } | |
| 151 | - | |
| 152 | - @Test | |
| 153 | - public void removeBraces() { | |
| 154 | - assertNull(Strings.removeBraces(null)); | |
| 155 | - assertEquals("", Strings.removeBraces("")); | |
| 156 | - assertEquals(" ", Strings.removeBraces(" ")); | |
| 157 | - assertEquals(" {x} ", Strings.removeBraces(" {x} ")); | |
| 158 | - assertEquals("{x} ", Strings.removeBraces("{x} ")); | |
| 159 | - assertEquals(" {x}", Strings.removeBraces(" {x}")); | |
| 160 | - assertEquals("x", Strings.removeBraces("{x}")); | |
| 161 | - assertEquals("a b c", Strings.removeBraces("{a b c}")); | |
| 162 | - assertEquals("{}", Strings.removeBraces("{}")); | |
| 163 | - assertEquals("{}", Strings.removeBraces("{{}}")); | |
| 164 | - assertEquals("?", Strings.removeBraces("{?}")); | |
| 165 | - assertEquals("*", Strings.removeBraces("{*}")); | |
| 166 | - } | |
| 167 | - | |
| 168 | - @Test | |
| 169 | - public void insertBraces() { | |
| 170 | - assertNull(Strings.insertBraces(null)); | |
| 171 | - assertEquals("", Strings.insertBraces("")); | |
| 172 | - assertEquals(" ", Strings.insertBraces(" ")); | |
| 173 | - assertEquals("{ x }", Strings.insertBraces(" x ")); | |
| 174 | - assertEquals("{ {x} }", Strings.insertBraces(" {x} ")); | |
| 175 | - assertEquals("{{x}", Strings.insertBraces("{x")); | |
| 176 | - assertEquals("{*}", Strings.insertBraces("*")); | |
| 177 | - assertEquals("{?}", Strings.insertBraces("?")); | |
| 178 | - } | |
| 179 | - | |
| 180 | - @Test | |
| 181 | - public void removeCharsWhenStringIsNull() { | |
| 182 | - assertEquals(null, Strings.removeChars(null, 'a')); | |
| 183 | - } | |
| 184 | - | |
| 185 | - @Test | |
| 186 | - public void removeCharsWhenStringIsNotNull() { | |
| 187 | - String string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus lobortis."; | |
| 188 | - string = Strings.removeChars(string, 'L', 'l'); | |
| 189 | - assertEquals(-1, string.indexOf('L')); | |
| 190 | - assertEquals(-1, string.indexOf('l')); | |
| 191 | - } | |
| 192 | - | |
| 193 | - @Test | |
| 194 | - public void insertZeros() { | |
| 195 | - String string = "Lorem ipsum"; | |
| 196 | - assertEquals("00000", Strings.insertZeros(null, 5)); | |
| 197 | - assertEquals(string, Strings.insertZeros(string, string.length() - 1)); | |
| 198 | - assertEquals(string, Strings.insertZeros(string, string.length())); | |
| 199 | - assertEquals("0" + string, Strings.insertZeros(string, string.length() + 1)); | |
| 200 | - assertEquals("00" + string, Strings.insertZeros(string, string.length() + 2)); | |
| 201 | - } | |
| 202 | -} |
impl/core/src/test/java/util/beans/BeansTest.java
| ... | ... | @@ -1,111 +0,0 @@ |
| 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 util.beans; | |
| 38 | - | |
| 39 | -import static org.junit.Assert.assertEquals; | |
| 40 | -import static org.junit.Assert.fail; | |
| 41 | - | |
| 42 | -import java.util.NoSuchElementException; | |
| 43 | - | |
| 44 | -import org.jboss.arquillian.container.test.api.Deployment; | |
| 45 | -import org.jboss.arquillian.junit.Arquillian; | |
| 46 | -import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
| 47 | -import org.junit.Test; | |
| 48 | -import org.junit.runner.RunWith; | |
| 49 | - | |
| 50 | -import test.Tests; | |
| 51 | -import br.gov.frameworkdemoiselle.DemoiselleException; | |
| 52 | -import br.gov.frameworkdemoiselle.util.Beans; | |
| 53 | - | |
| 54 | -@RunWith(Arquillian.class) | |
| 55 | -public class BeansTest { | |
| 56 | - | |
| 57 | - @Deployment | |
| 58 | - public static JavaArchive createDeployment() { | |
| 59 | - JavaArchive deployment = Tests.createDeployment(BeansTest.class); | |
| 60 | - return deployment; | |
| 61 | - } | |
| 62 | - | |
| 63 | - @Test | |
| 64 | - public void beanClassAndQualifierTest() { | |
| 65 | - assertEquals(DummyQualifiedOne.class, | |
| 66 | - (Beans.getReference(DummyQualified.class, DummyQualifiedOne.class.getAnnotations())).getClass()); | |
| 67 | - assertEquals(DummyQualifiedTwo.class, | |
| 68 | - (Beans.getReference(DummyQualified.class, DummyQualifiedTwo.class.getAnnotations())).getClass()); | |
| 69 | - } | |
| 70 | - | |
| 71 | - @Test | |
| 72 | - public void beanClassAndQualifierExceptionTest() { | |
| 73 | - try { | |
| 74 | - Beans.getReference(DummyQualified.class, DummyQualifiedOne.class.getAnnotations()[0], | |
| 75 | - DummyQualifiedTwo.class.getAnnotations()[0]); | |
| 76 | - fail(); | |
| 77 | - } catch (DemoiselleException cause) { | |
| 78 | - assertEquals(NoSuchElementException.class, cause.getCause().getClass()); | |
| 79 | - } | |
| 80 | - } | |
| 81 | - | |
| 82 | - @Test | |
| 83 | - public void beanClassTest() { | |
| 84 | - assertEquals(DummyImplementation.class, Beans.getReference(Dummy.class).getClass()); | |
| 85 | - } | |
| 86 | - | |
| 87 | - @Test | |
| 88 | - public void beanClassExceptionTest() { | |
| 89 | - try { | |
| 90 | - Beans.getReference(InexistentImplementationInterface.class); | |
| 91 | - fail(); | |
| 92 | - } catch (DemoiselleException cause) { | |
| 93 | - assertEquals(NoSuchElementException.class, cause.getCause().getClass()); | |
| 94 | - } | |
| 95 | - } | |
| 96 | - | |
| 97 | - @Test | |
| 98 | - public void beanNameTest() { | |
| 99 | - assertEquals(DummyEL.class, Beans.getReference("DummyClass").getClass()); | |
| 100 | - } | |
| 101 | - | |
| 102 | - @Test | |
| 103 | - public void beanNameExceptionTest() { | |
| 104 | - try { | |
| 105 | - Beans.getReference("DummyEL"); | |
| 106 | - fail(); | |
| 107 | - } catch (DemoiselleException cause) { | |
| 108 | - assertEquals(NoSuchElementException.class, cause.getCause().getClass()); | |
| 109 | - } | |
| 110 | - } | |
| 111 | -} |
impl/core/src/test/java/util/beans/Dummy.java
| ... | ... | @@ -1,42 +0,0 @@ |
| 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 util.beans; | |
| 38 | - | |
| 39 | -public interface Dummy { | |
| 40 | - | |
| 41 | - public void dummyMethod(); | |
| 42 | -} |
impl/core/src/test/java/util/beans/DummyEL.java
| ... | ... | @@ -1,43 +0,0 @@ |
| 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 util.beans; | |
| 38 | - | |
| 39 | -import javax.inject.Named; | |
| 40 | - | |
| 41 | -@Named("DummyClass") | |
| 42 | -public class DummyEL { | |
| 43 | -} |
impl/core/src/test/java/util/beans/DummyImplementation.java
| ... | ... | @@ -1,47 +0,0 @@ |
| 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 util.beans; | |
| 38 | - | |
| 39 | -import br.gov.frameworkdemoiselle.annotation.Priority; | |
| 40 | - | |
| 41 | -@Priority(value = 1) | |
| 42 | -public class DummyImplementation implements Dummy { | |
| 43 | - | |
| 44 | - @Override | |
| 45 | - public void dummyMethod() { | |
| 46 | - } | |
| 47 | -} |
impl/core/src/test/java/util/beans/DummyQualified.java
| ... | ... | @@ -1,40 +0,0 @@ |
| 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 util.beans; | |
| 38 | - | |
| 39 | -public interface DummyQualified { | |
| 40 | -} |
impl/core/src/test/java/util/beans/DummyQualifiedOne.java
| ... | ... | @@ -1,44 +0,0 @@ |
| 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 util.beans; | |
| 38 | - | |
| 39 | -import javax.enterprise.inject.Alternative; | |
| 40 | - | |
| 41 | -@Alternative | |
| 42 | -@QualifierOne | |
| 43 | -public class DummyQualifiedOne implements DummyQualified { | |
| 44 | -} |
impl/core/src/test/java/util/beans/DummyQualifiedTwo.java
| ... | ... | @@ -1,41 +0,0 @@ |
| 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 util.beans; | |
| 38 | - | |
| 39 | -@QualifierTwo | |
| 40 | -public class DummyQualifiedTwo implements DummyQualified{ | |
| 41 | -} |
impl/core/src/test/java/util/beans/InexistentImplementationInterface.java
| ... | ... | @@ -1,40 +0,0 @@ |
| 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 util.beans; | |
| 38 | - | |
| 39 | -public interface InexistentImplementationInterface { | |
| 40 | -} |
impl/core/src/test/java/util/beans/QualifierOne.java
| ... | ... | @@ -1,54 +0,0 @@ |
| 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 util.beans; | |
| 38 | - | |
| 39 | -import static java.lang.annotation.ElementType.FIELD; | |
| 40 | -import static java.lang.annotation.ElementType.METHOD; | |
| 41 | -import static java.lang.annotation.ElementType.PARAMETER; | |
| 42 | -import static java.lang.annotation.ElementType.TYPE; | |
| 43 | -import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| 44 | - | |
| 45 | -import java.lang.annotation.Retention; | |
| 46 | -import java.lang.annotation.Target; | |
| 47 | - | |
| 48 | -import javax.inject.Qualifier; | |
| 49 | - | |
| 50 | -@Qualifier | |
| 51 | -@Target({TYPE, METHOD, PARAMETER, FIELD}) | |
| 52 | -@Retention(RUNTIME) | |
| 53 | -public @interface QualifierOne { | |
| 54 | -} |
impl/core/src/test/java/util/beans/QualifierTwo.java
| ... | ... | @@ -1,54 +0,0 @@ |
| 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 util.beans; | |
| 38 | - | |
| 39 | -import static java.lang.annotation.ElementType.FIELD; | |
| 40 | -import static java.lang.annotation.ElementType.METHOD; | |
| 41 | -import static java.lang.annotation.ElementType.PARAMETER; | |
| 42 | -import static java.lang.annotation.ElementType.TYPE; | |
| 43 | -import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| 44 | - | |
| 45 | -import java.lang.annotation.Retention; | |
| 46 | -import java.lang.annotation.Target; | |
| 47 | - | |
| 48 | -import javax.inject.Qualifier; | |
| 49 | - | |
| 50 | -@Qualifier | |
| 51 | -@Target({TYPE, METHOD, PARAMETER, FIELD}) | |
| 52 | -@Retention(RUNTIME) | |
| 53 | -public @interface QualifierTwo { | |
| 54 | -} | |
| 55 | 0 | \ No newline at end of file |
impl/core/src/test/java/util/beans/qualifier/QualifiedBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,40 @@ |
| 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 util.beans.qualifier; | |
| 38 | + | |
| 39 | +public interface QualifiedBean { | |
| 40 | +} | ... | ... |
impl/core/src/test/java/util/beans/qualifier/QualifiedBeanOne.java
0 → 100644
| ... | ... | @@ -0,0 +1,41 @@ |
| 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 util.beans.qualifier; | |
| 38 | + | |
| 39 | +@QualifierOne | |
| 40 | +public class QualifiedBeanOne implements QualifiedBean { | |
| 41 | +} | ... | ... |
impl/core/src/test/java/util/beans/qualifier/QualifiedBeanTwo.java
0 → 100644
| ... | ... | @@ -0,0 +1,41 @@ |
| 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 util.beans.qualifier; | |
| 38 | + | |
| 39 | +@QualifierTwo | |
| 40 | +public class QualifiedBeanTwo implements QualifiedBean{ | |
| 41 | +} | ... | ... |
impl/core/src/test/java/util/beans/qualifier/QualifiedBeansTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,81 @@ |
| 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 util.beans.qualifier; | |
| 38 | + | |
| 39 | +import static org.junit.Assert.assertEquals; | |
| 40 | +import static org.junit.Assert.fail; | |
| 41 | + | |
| 42 | +import java.util.NoSuchElementException; | |
| 43 | + | |
| 44 | +import org.jboss.arquillian.container.test.api.Deployment; | |
| 45 | +import org.jboss.arquillian.junit.Arquillian; | |
| 46 | +import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
| 47 | +import org.junit.Test; | |
| 48 | +import org.junit.runner.RunWith; | |
| 49 | + | |
| 50 | +import test.Tests; | |
| 51 | +import br.gov.frameworkdemoiselle.DemoiselleException; | |
| 52 | +import br.gov.frameworkdemoiselle.util.Beans; | |
| 53 | + | |
| 54 | +@RunWith(Arquillian.class) | |
| 55 | +public class QualifiedBeansTest { | |
| 56 | + | |
| 57 | + @Deployment | |
| 58 | + public static JavaArchive createDeployment() { | |
| 59 | + JavaArchive deployment = Tests.createDeployment(QualifiedBeansTest.class); | |
| 60 | + return deployment; | |
| 61 | + } | |
| 62 | + | |
| 63 | + @Test | |
| 64 | + public void beanClassAndQualifierTest() { | |
| 65 | + assertEquals(QualifiedBeanOne.class, | |
| 66 | + (Beans.getReference(QualifiedBean.class, QualifiedBeanOne.class.getAnnotations())).getClass()); | |
| 67 | + assertEquals(QualifiedBeanTwo.class, | |
| 68 | + (Beans.getReference(QualifiedBean.class, QualifiedBeanTwo.class.getAnnotations())).getClass()); | |
| 69 | + } | |
| 70 | + | |
| 71 | + @Test | |
| 72 | + public void beanClassAndQualifierExceptionTest() { | |
| 73 | + try { | |
| 74 | + Beans.getReference(QualifiedBean.class, QualifiedBeanOne.class.getAnnotations()[0], | |
| 75 | + QualifiedBeanTwo.class.getAnnotations()[0]); | |
| 76 | + fail(); | |
| 77 | + } catch (DemoiselleException cause) { | |
| 78 | + assertEquals(NoSuchElementException.class, cause.getCause().getClass()); | |
| 79 | + } | |
| 80 | + } | |
| 81 | +} | ... | ... |
impl/core/src/test/java/util/beans/qualifier/QualifierOne.java
0 → 100644
| ... | ... | @@ -0,0 +1,54 @@ |
| 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 util.beans.qualifier; | |
| 38 | + | |
| 39 | +import static java.lang.annotation.ElementType.FIELD; | |
| 40 | +import static java.lang.annotation.ElementType.METHOD; | |
| 41 | +import static java.lang.annotation.ElementType.PARAMETER; | |
| 42 | +import static java.lang.annotation.ElementType.TYPE; | |
| 43 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| 44 | + | |
| 45 | +import java.lang.annotation.Retention; | |
| 46 | +import java.lang.annotation.Target; | |
| 47 | + | |
| 48 | +import javax.inject.Qualifier; | |
| 49 | + | |
| 50 | +@Qualifier | |
| 51 | +@Target({TYPE, METHOD, PARAMETER, FIELD}) | |
| 52 | +@Retention(RUNTIME) | |
| 53 | +public @interface QualifierOne { | |
| 54 | +} | ... | ... |
impl/core/src/test/java/util/beans/qualifier/QualifierTwo.java
0 → 100644
| ... | ... | @@ -0,0 +1,54 @@ |
| 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 util.beans.qualifier; | |
| 38 | + | |
| 39 | +import static java.lang.annotation.ElementType.FIELD; | |
| 40 | +import static java.lang.annotation.ElementType.METHOD; | |
| 41 | +import static java.lang.annotation.ElementType.PARAMETER; | |
| 42 | +import static java.lang.annotation.ElementType.TYPE; | |
| 43 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| 44 | + | |
| 45 | +import java.lang.annotation.Retention; | |
| 46 | +import java.lang.annotation.Target; | |
| 47 | + | |
| 48 | +import javax.inject.Qualifier; | |
| 49 | + | |
| 50 | +@Qualifier | |
| 51 | +@Target({TYPE, METHOD, PARAMETER, FIELD}) | |
| 52 | +@Retention(RUNTIME) | |
| 53 | +public @interface QualifierTwo { | |
| 54 | +} | |
| 0 | 55 | \ No newline at end of file | ... | ... |
impl/core/src/test/java/util/beans/simple/AloneBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,40 @@ |
| 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 util.beans.simple; | |
| 38 | + | |
| 39 | +public interface AloneBean { | |
| 40 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,42 @@ |
| 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 util.beans.simple; | |
| 38 | + | |
| 39 | +public interface Bean { | |
| 40 | + | |
| 41 | + public void dummyMethod(); | |
| 42 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,47 @@ |
| 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 util.beans.simple; | |
| 38 | + | |
| 39 | +import br.gov.frameworkdemoiselle.annotation.Priority; | |
| 40 | + | |
| 41 | +@Priority(value = 1) | |
| 42 | +public class BeanImpl implements Bean { | |
| 43 | + | |
| 44 | + @Override | |
| 45 | + public void dummyMethod() { | |
| 46 | + } | |
| 47 | +} | ... | ... |
impl/core/src/test/java/util/beans/simple/NamedBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,43 @@ |
| 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 util.beans.simple; | |
| 38 | + | |
| 39 | +import javax.inject.Named; | |
| 40 | + | |
| 41 | +@Named("DummyClass") | |
| 42 | +public class NamedBean { | |
| 43 | +} | ... | ... |
impl/core/src/test/java/util/beans/simple/SimpleBeansTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,92 @@ |
| 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 util.beans.simple; | |
| 38 | + | |
| 39 | +import static org.junit.Assert.assertEquals; | |
| 40 | +import static org.junit.Assert.fail; | |
| 41 | + | |
| 42 | +import java.util.NoSuchElementException; | |
| 43 | + | |
| 44 | +import org.jboss.arquillian.container.test.api.Deployment; | |
| 45 | +import org.jboss.arquillian.junit.Arquillian; | |
| 46 | +import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
| 47 | +import org.junit.Test; | |
| 48 | +import org.junit.runner.RunWith; | |
| 49 | + | |
| 50 | +import test.Tests; | |
| 51 | +import br.gov.frameworkdemoiselle.DemoiselleException; | |
| 52 | +import br.gov.frameworkdemoiselle.util.Beans; | |
| 53 | + | |
| 54 | +@RunWith(Arquillian.class) | |
| 55 | +public class SimpleBeansTest { | |
| 56 | + | |
| 57 | + @Deployment | |
| 58 | + public static JavaArchive createDeployment() { | |
| 59 | + JavaArchive deployment = Tests.createDeployment(SimpleBeansTest.class); | |
| 60 | + return deployment; | |
| 61 | + } | |
| 62 | + | |
| 63 | + @Test | |
| 64 | + public void beanClassTest() { | |
| 65 | + assertEquals(BeanImpl.class, Beans.getReference(Bean.class).getClass()); | |
| 66 | + } | |
| 67 | + | |
| 68 | + @Test | |
| 69 | + public void beanClassExceptionTest() { | |
| 70 | + try { | |
| 71 | + Beans.getReference(AloneBean.class); | |
| 72 | + fail(); | |
| 73 | + } catch (DemoiselleException cause) { | |
| 74 | + assertEquals(NoSuchElementException.class, cause.getCause().getClass()); | |
| 75 | + } | |
| 76 | + } | |
| 77 | + | |
| 78 | + @Test | |
| 79 | + public void beanNameTest() { | |
| 80 | + assertEquals(NamedBean.class, Beans.getReference("DummyClass").getClass()); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @Test | |
| 84 | + public void beanNameExceptionTest() { | |
| 85 | + try { | |
| 86 | + Beans.getReference("NamedBean"); | |
| 87 | + fail(); | |
| 88 | + } catch (DemoiselleException cause) { | |
| 89 | + assertEquals(NoSuchElementException.class, cause.getCause().getClass()); | |
| 90 | + } | |
| 91 | + } | |
| 92 | +} | ... | ... |
impl/core/src/test/java/util/exception/ExceptionsTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,90 @@ |
| 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 util.exception; | |
| 38 | + | |
| 39 | +import static org.junit.Assert.assertFalse; | |
| 40 | +import static org.junit.Assert.assertTrue; | |
| 41 | +import static org.junit.Assert.fail; | |
| 42 | + | |
| 43 | +import org.junit.Test; | |
| 44 | + | |
| 45 | +import br.gov.frameworkdemoiselle.exception.ApplicationException; | |
| 46 | +import br.gov.frameworkdemoiselle.util.Exceptions; | |
| 47 | + | |
| 48 | +public class ExceptionsTest { | |
| 49 | + | |
| 50 | + @Test | |
| 51 | + public void testIsApplicationException() { | |
| 52 | + assertTrue(Exceptions.isApplicationException(new MyException())); | |
| 53 | + assertFalse(Exceptions.isApplicationException(new Exception())); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @Test | |
| 57 | + public void testHandleRuntimeException() { | |
| 58 | + try { | |
| 59 | + Exceptions.handleToRuntimeException(new SomeRuntimeException()); | |
| 60 | + fail(); | |
| 61 | + } catch (Throwable t) { | |
| 62 | + if (!RuntimeException.class.isInstance(t)) { | |
| 63 | + fail(); | |
| 64 | + } | |
| 65 | + } | |
| 66 | + | |
| 67 | + try { | |
| 68 | + Exceptions.handleToRuntimeException(new Exception()); | |
| 69 | + fail(); | |
| 70 | + } catch (Throwable t) { | |
| 71 | + if (!RuntimeException.class.isInstance(t)) { | |
| 72 | + fail(); | |
| 73 | + } | |
| 74 | + } | |
| 75 | + | |
| 76 | + } | |
| 77 | + | |
| 78 | +} | |
| 79 | + | |
| 80 | +@ApplicationException | |
| 81 | +class MyException extends Exception { | |
| 82 | + | |
| 83 | + private static final long serialVersionUID = 1L; | |
| 84 | +} | |
| 85 | + | |
| 86 | +class SomeRuntimeException extends RuntimeException { | |
| 87 | + | |
| 88 | + private static final long serialVersionUID = 1L; | |
| 89 | + | |
| 90 | +} | ... | ... |
impl/core/src/test/java/util/reflection/ReflectionsTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,75 @@ |
| 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 util.reflection; | |
| 38 | + | |
| 39 | +import static org.junit.Assert.assertEquals; | |
| 40 | + | |
| 41 | +import java.lang.reflect.Member; | |
| 42 | + | |
| 43 | +import org.junit.Test; | |
| 44 | + | |
| 45 | +import br.gov.frameworkdemoiselle.util.Reflections; | |
| 46 | + | |
| 47 | +public class ReflectionsTest { | |
| 48 | + | |
| 49 | + @Test | |
| 50 | + public void testGetGenericTypeArgumentClass() { | |
| 51 | + assertEquals(Long.class, Reflections.getGenericTypeArgument(OtherClass.class, 0)); | |
| 52 | + assertEquals(String.class, Reflections.getGenericTypeArgument(OtherClass.class, 1)); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @Test | |
| 56 | + public void testGetGenericTypeArgumentMember() throws SecurityException, NoSuchFieldException { | |
| 57 | + Member[] members = OtherClass.class.getFields(); | |
| 58 | + assertEquals(Long.class, Reflections.getGenericTypeArgument(members[0], 0)); | |
| 59 | + assertEquals(String.class, Reflections.getGenericTypeArgument(members[1], 0)); | |
| 60 | + } | |
| 61 | +} | |
| 62 | + | |
| 63 | +class SomeClass<T, I> { | |
| 64 | + | |
| 65 | + public void setNumber(final T t) { | |
| 66 | + | |
| 67 | + } | |
| 68 | +} | |
| 69 | + | |
| 70 | +class OtherClass extends SomeClass<Long, String> { | |
| 71 | + | |
| 72 | + public Class<Long> number; | |
| 73 | + | |
| 74 | + public Class<String> text; | |
| 75 | +} | ... | ... |
impl/core/src/test/java/util/resourcebundle/ResourceBundleTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,66 @@ |
| 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 util.resourcebundle; | |
| 38 | + | |
| 39 | +import static org.junit.Assert.assertEquals; | |
| 40 | + | |
| 41 | +import java.util.Locale; | |
| 42 | + | |
| 43 | +import org.junit.Before; | |
| 44 | +import org.junit.Test; | |
| 45 | + | |
| 46 | +import br.gov.frameworkdemoiselle.util.ResourceBundle; | |
| 47 | + | |
| 48 | +public class ResourceBundleTest { | |
| 49 | + | |
| 50 | + private ResourceBundle resourceBundle; | |
| 51 | + | |
| 52 | + @Before | |
| 53 | + public void setUp() throws Exception { | |
| 54 | + resourceBundle = new ResourceBundle("resourcebundle/resource-bundle", new Locale("pt")); | |
| 55 | + } | |
| 56 | + | |
| 57 | + @Test | |
| 58 | + public void getString() { | |
| 59 | + assertEquals("no params", resourceBundle.getString("msgWithoutParams")); | |
| 60 | + | |
| 61 | + assertEquals("params: a, b", resourceBundle.getString("msgWithParams", "a", "b")); | |
| 62 | + | |
| 63 | + assertEquals("params: {0}, {1}", resourceBundle.getString("msgWithParams")); | |
| 64 | + } | |
| 65 | + | |
| 66 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,202 @@ |
| 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 util.string; | |
| 38 | + | |
| 39 | +import static org.junit.Assert.assertEquals; | |
| 40 | +import static org.junit.Assert.assertFalse; | |
| 41 | +import static org.junit.Assert.assertNull; | |
| 42 | +import static org.junit.Assert.assertTrue; | |
| 43 | + | |
| 44 | +import org.junit.Test; | |
| 45 | + | |
| 46 | +import br.gov.frameworkdemoiselle.annotation.Ignore; | |
| 47 | +import br.gov.frameworkdemoiselle.util.Strings; | |
| 48 | + | |
| 49 | +public class StringsTest { | |
| 50 | + | |
| 51 | + @Test | |
| 52 | + public void getString() { | |
| 53 | + testEqualsGetString("teste", "teste"); | |
| 54 | + testEqualsGetString("", ""); | |
| 55 | + testEqualsGetString(null, null); | |
| 56 | + testEqualsGetString(null, null, "teste"); | |
| 57 | + testEqualsGetString("{0}", "teste", "teste"); | |
| 58 | + testEqualsGetString("teste", "teste", (Object[]) null); | |
| 59 | + testEqualsGetString("teste {0}", "teste 1", "1"); | |
| 60 | + testEqualsGetString("{0} teste", "Um teste", "Um"); | |
| 61 | + testEqualsGetString("{1} testando {0}", "Apenas testando novamente", "novamente", "Apenas"); | |
| 62 | + testEqualsGetString("{0} testando {1}", "Apenas testando {1}", "Apenas", null); | |
| 63 | + testEqualsGetString("testando {1} novamente", "testando isto novamente", "aquilo", "isto"); | |
| 64 | + testEqualsGetString("teste", "teste", "1", "2"); | |
| 65 | + testEqualsGetString("teste {0}.", "teste \\.", "\\"); | |
| 66 | + } | |
| 67 | + | |
| 68 | + @Test | |
| 69 | + public void isEmpty() { | |
| 70 | + assertTrue(Strings.isEmpty(null)); | |
| 71 | + assertTrue(Strings.isEmpty("")); | |
| 72 | + assertTrue(Strings.isEmpty(" ")); | |
| 73 | + assertTrue(Strings.isEmpty(" ")); | |
| 74 | + | |
| 75 | + assertFalse(Strings.isEmpty(" _ ")); | |
| 76 | + assertFalse(Strings.isEmpty(".")); | |
| 77 | + assertFalse(Strings.isEmpty("null")); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @Test | |
| 81 | + public void isResourceBundleKeyFormat() { | |
| 82 | + assertTrue(Strings.isResourceBundleKeyFormat("{x}")); | |
| 83 | + assertTrue(Strings.isResourceBundleKeyFormat("{.}")); | |
| 84 | + assertTrue(Strings.isResourceBundleKeyFormat("{*}")); | |
| 85 | + assertTrue(Strings.isResourceBundleKeyFormat("{$}")); | |
| 86 | + assertFalse(Strings.isResourceBundleKeyFormat("{}")); | |
| 87 | + assertFalse(Strings.isResourceBundleKeyFormat("")); | |
| 88 | + assertFalse(Strings.isResourceBundleKeyFormat(" ")); | |
| 89 | + assertFalse(Strings.isResourceBundleKeyFormat(null)); | |
| 90 | + assertFalse(Strings.isResourceBundleKeyFormat("a{a}a")); | |
| 91 | + assertFalse(Strings.isResourceBundleKeyFormat("a{a}")); | |
| 92 | + assertFalse(Strings.isResourceBundleKeyFormat("{a}a")); | |
| 93 | + assertFalse(Strings.isResourceBundleKeyFormat(" {a} ")); | |
| 94 | + assertFalse(Strings.isResourceBundleKeyFormat("{a")); | |
| 95 | + assertFalse(Strings.isResourceBundleKeyFormat("a}")); | |
| 96 | + } | |
| 97 | + | |
| 98 | + @Test | |
| 99 | + public void camelCaseToSymbolSeparated() { | |
| 100 | + assertEquals(null, Strings.camelCaseToSymbolSeparated(null, null)); | |
| 101 | + assertEquals(null, Strings.camelCaseToSymbolSeparated(null, ".")); | |
| 102 | + assertEquals("myvar", Strings.camelCaseToSymbolSeparated("myVar", null)); | |
| 103 | + assertEquals("myvar", Strings.camelCaseToSymbolSeparated("myVar", "")); | |
| 104 | + assertEquals("my.var", Strings.camelCaseToSymbolSeparated("myVar", ".")); | |
| 105 | + assertEquals("my-var", Strings.camelCaseToSymbolSeparated("MyVar", "-")); | |
| 106 | + assertEquals("my?var?name", Strings.camelCaseToSymbolSeparated("myVarName", "?")); | |
| 107 | + assertEquals("my___var___name", Strings.camelCaseToSymbolSeparated("myVarName", "___")); | |
| 108 | + } | |
| 109 | + | |
| 110 | + @Test | |
| 111 | + public void firstToUpper() { | |
| 112 | + assertNull(Strings.firstToUpper(null)); | |
| 113 | + assertEquals("", Strings.firstToUpper("")); | |
| 114 | + assertEquals("A", Strings.firstToUpper("a")); | |
| 115 | + assertEquals("A", Strings.firstToUpper("A")); | |
| 116 | + assertEquals("Ab", Strings.firstToUpper("Ab")); | |
| 117 | + assertEquals("AB", Strings.firstToUpper("AB")); | |
| 118 | + assertEquals("Ab", Strings.firstToUpper("ab")); | |
| 119 | + assertEquals("AB", Strings.firstToUpper("aB")); | |
| 120 | + } | |
| 121 | + | |
| 122 | + @Test | |
| 123 | + public void toStringWhenObjectIsNull() { | |
| 124 | + assertEquals("", Strings.toString(null)); | |
| 125 | + } | |
| 126 | + | |
| 127 | + @Test | |
| 128 | + public void classToString() throws SecurityException, NoSuchFieldException { | |
| 129 | + @SuppressWarnings("unused") | |
| 130 | + class Test { | |
| 131 | + | |
| 132 | + private String name = "myName"; | |
| 133 | + | |
| 134 | + private String lastname = "myLastname"; | |
| 135 | + | |
| 136 | + private String nullField = null; | |
| 137 | + | |
| 138 | + @Ignore | |
| 139 | + private String ignore = "ignoreMe"; | |
| 140 | + | |
| 141 | + } | |
| 142 | + | |
| 143 | + String result = Strings.toString(new Test()); | |
| 144 | + assertTrue(result.contains("Test [name=myName, lastname=myLastname, nullField=null, this")); | |
| 145 | + } | |
| 146 | + | |
| 147 | + private void testEqualsGetString(final String in, final String expected, final Object... params) { | |
| 148 | + String out = Strings.getString(in, params); | |
| 149 | + assertEquals(expected, out); | |
| 150 | + } | |
| 151 | + | |
| 152 | + @Test | |
| 153 | + public void removeBraces() { | |
| 154 | + assertNull(Strings.removeBraces(null)); | |
| 155 | + assertEquals("", Strings.removeBraces("")); | |
| 156 | + assertEquals(" ", Strings.removeBraces(" ")); | |
| 157 | + assertEquals(" {x} ", Strings.removeBraces(" {x} ")); | |
| 158 | + assertEquals("{x} ", Strings.removeBraces("{x} ")); | |
| 159 | + assertEquals(" {x}", Strings.removeBraces(" {x}")); | |
| 160 | + assertEquals("x", Strings.removeBraces("{x}")); | |
| 161 | + assertEquals("a b c", Strings.removeBraces("{a b c}")); | |
| 162 | + assertEquals("{}", Strings.removeBraces("{}")); | |
| 163 | + assertEquals("{}", Strings.removeBraces("{{}}")); | |
| 164 | + assertEquals("?", Strings.removeBraces("{?}")); | |
| 165 | + assertEquals("*", Strings.removeBraces("{*}")); | |
| 166 | + } | |
| 167 | + | |
| 168 | + @Test | |
| 169 | + public void insertBraces() { | |
| 170 | + assertNull(Strings.insertBraces(null)); | |
| 171 | + assertEquals("", Strings.insertBraces("")); | |
| 172 | + assertEquals(" ", Strings.insertBraces(" ")); | |
| 173 | + assertEquals("{ x }", Strings.insertBraces(" x ")); | |
| 174 | + assertEquals("{ {x} }", Strings.insertBraces(" {x} ")); | |
| 175 | + assertEquals("{{x}", Strings.insertBraces("{x")); | |
| 176 | + assertEquals("{*}", Strings.insertBraces("*")); | |
| 177 | + assertEquals("{?}", Strings.insertBraces("?")); | |
| 178 | + } | |
| 179 | + | |
| 180 | + @Test | |
| 181 | + public void removeCharsWhenStringIsNull() { | |
| 182 | + assertEquals(null, Strings.removeChars(null, 'a')); | |
| 183 | + } | |
| 184 | + | |
| 185 | + @Test | |
| 186 | + public void removeCharsWhenStringIsNotNull() { | |
| 187 | + String string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus lobortis."; | |
| 188 | + string = Strings.removeChars(string, 'L', 'l'); | |
| 189 | + assertEquals(-1, string.indexOf('L')); | |
| 190 | + assertEquals(-1, string.indexOf('l')); | |
| 191 | + } | |
| 192 | + | |
| 193 | + @Test | |
| 194 | + public void insertZeros() { | |
| 195 | + String string = "Lorem ipsum"; | |
| 196 | + assertEquals("00000", Strings.insertZeros(null, 5)); | |
| 197 | + assertEquals(string, Strings.insertZeros(string, string.length() - 1)); | |
| 198 | + assertEquals(string, Strings.insertZeros(string, string.length())); | |
| 199 | + assertEquals("0" + string, Strings.insertZeros(string, string.length() + 1)); | |
| 200 | + assertEquals("00" + string, Strings.insertZeros(string, string.length() + 2)); | |
| 201 | + } | |
| 202 | +} | ... | ... |