Commit 8835bb9f302ee2238e9ede3f4911845c7b0a9c93
1 parent
aacdb6c9
Exists in
master
Refatoração da classe ContextsTest
Showing
1 changed file
with
16 additions
and
1 deletions
Show diff stats
impl/core/src/test/java/br/gov/frameworkdemoiselle/internal/context/ContextsTest.java
... | ... | @@ -37,14 +37,18 @@ |
37 | 37 | package br.gov.frameworkdemoiselle.internal.context; |
38 | 38 | |
39 | 39 | import static org.easymock.EasyMock.createMock; |
40 | +import static org.easymock.EasyMock.expect; | |
40 | 41 | import static org.easymock.EasyMock.expectLastCall; |
41 | -import static org.easymock.EasyMock.replay; | |
42 | +//import static org.easymock.EasyMock.replay; | |
43 | +import static org.powermock.api.easymock.PowerMock.mockStatic; | |
44 | +import static org.powermock.api.easymock.PowerMock.replay; | |
42 | 45 | import static org.junit.Assert.assertEquals; |
43 | 46 | import static org.junit.Assert.assertFalse; |
44 | 47 | import static org.junit.Assert.assertTrue; |
45 | 48 | |
46 | 49 | import java.util.ArrayList; |
47 | 50 | import java.util.List; |
51 | +import java.util.Locale; | |
48 | 52 | |
49 | 53 | import javax.enterprise.context.ApplicationScoped; |
50 | 54 | import javax.enterprise.context.RequestScoped; |
... | ... | @@ -53,9 +57,15 @@ import javax.enterprise.inject.spi.AfterBeanDiscovery; |
53 | 57 | |
54 | 58 | import org.junit.Before; |
55 | 59 | import org.junit.Test; |
60 | +import org.junit.runner.RunWith; | |
61 | +import org.powermock.core.classloader.annotations.PrepareForTest; | |
62 | +import org.powermock.modules.junit4.PowerMockRunner; | |
56 | 63 | |
57 | 64 | import br.gov.frameworkdemoiselle.annotation.ViewScoped; |
65 | +import br.gov.frameworkdemoiselle.util.Beans; | |
58 | 66 | |
67 | +@RunWith(PowerMockRunner.class) | |
68 | +@PrepareForTest(Beans.class) | |
59 | 69 | public class ContextsTest { |
60 | 70 | |
61 | 71 | private AfterBeanDiscovery event; |
... | ... | @@ -63,6 +73,11 @@ public class ContextsTest { |
63 | 73 | @Before |
64 | 74 | public void setUp() throws Exception { |
65 | 75 | Contexts.clear(); |
76 | + mockStatic(Beans.class); | |
77 | + | |
78 | + expect(Beans.getReference(Locale.class)).andReturn(Locale.getDefault()); | |
79 | + | |
80 | + replay(Beans.class); | |
66 | 81 | } |
67 | 82 | |
68 | 83 | @Test | ... | ... |