Commit f16c2d8266db6db419c84c9f8b292f187c093e97
1 parent
1de62462
Exists in
master
Adição dos testes para update e insert no DelegateCrud
Showing
1 changed file
with
11 additions
and
3 deletions
Show diff stats
impl/core/src/test/java/br/gov/frameworkdemoiselle/template/DelegateCrudTest.java
| @@ -91,25 +91,33 @@ public class DelegateCrudTest { | @@ -91,25 +91,33 @@ public class DelegateCrudTest { | ||
| 91 | PowerMock.verify(); | 91 | PowerMock.verify(); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | - @Ignore | 94 | + @SuppressWarnings("unchecked") |
| 95 | @Test | 95 | @Test |
| 96 | public void testUpdate() { | 96 | public void testUpdate() { |
| 97 | Whitebox.setInternalState(delegateCrud, "delegate", mockCrud); | 97 | Whitebox.setInternalState(delegateCrud, "delegate", mockCrud); |
| 98 | 98 | ||
| 99 | + mockStatic(Beans.class); | ||
| 100 | + | ||
| 101 | + expect(Beans.getReference(EasyMock.anyObject(Class.class))).andReturn(mockCrud); | ||
| 102 | + | ||
| 99 | Contact update = new Contact(); | 103 | Contact update = new Contact(); |
| 100 | mockCrud.update(update); | 104 | mockCrud.update(update); |
| 101 | - replayAll(mockCrud); | 105 | + replayAll(Beans.class, mockCrud); |
| 102 | 106 | ||
| 103 | delegateCrud.update(update); | 107 | delegateCrud.update(update); |
| 104 | 108 | ||
| 105 | verifyAll(); | 109 | verifyAll(); |
| 106 | } | 110 | } |
| 107 | 111 | ||
| 108 | - @Ignore | 112 | + @SuppressWarnings("unchecked") |
| 109 | @Test | 113 | @Test |
| 110 | public void testInsert() { | 114 | public void testInsert() { |
| 111 | Whitebox.setInternalState(delegateCrud, "delegate", mockCrud); | 115 | Whitebox.setInternalState(delegateCrud, "delegate", mockCrud); |
| 112 | 116 | ||
| 117 | + mockStatic(Beans.class); | ||
| 118 | + | ||
| 119 | + expect(Beans.getReference(EasyMock.anyObject(Class.class))).andReturn(mockCrud); | ||
| 120 | + | ||
| 113 | Contact insert = new Contact(); | 121 | Contact insert = new Contact(); |
| 114 | mockCrud.insert(insert); | 122 | mockCrud.insert(insert); |
| 115 | replayAll(mockCrud); | 123 | replayAll(mockCrud); |