aboutsummaryrefslogtreecommitdiffstats
path: root/BRMSGateway/src/test/java/org/onap
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@ericsson.com>2018-05-04 16:50:35 +0100
committerwaqas.ikram <waqas.ikram@ericsson.com>2018-05-04 17:21:45 +0100
commitfad662d64ab3cb3aa2969fbcb9d7ff14cc1f15f1 (patch)
treef6692599b5970a65a62757c06bab42ebee91525e /BRMSGateway/src/test/java/org/onap
parent833a2096df92eec273dc807cc930aee6e7cbc40e (diff)
Adding rollback for transaction handling
Change-Id: I90887aafdd3cc49940bb4ed4b9283ec8a25aa205 Issue-ID: POLICY-773 Signed-off-by: waqas.ikram <waqas.ikram@ericsson.com>
Diffstat (limited to 'BRMSGateway/src/test/java/org/onap')
-rw-r--r--BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java5
-rw-r--r--BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsPushTest.java6
2 files changed, 6 insertions, 5 deletions
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java
index 58bacef13..1a6dc4719 100644
--- a/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java
+++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java
@@ -30,6 +30,7 @@ import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.Query;
+import javax.persistence.TypedQuery;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -54,8 +55,8 @@ public class BrmsHandlerTest {
PowerMockito.when(Persistence.createEntityManagerFactory(any(), any())).thenReturn(emf);
final EntityTransaction et = Mockito.mock(EntityTransaction.class);
Mockito.when(em.getTransaction()).thenReturn(et);
- final Query query = Mockito.mock(Query.class);
- Mockito.when(em.createQuery(Mockito.anyString())).thenReturn(query);
+ final TypedQuery<?> query = Mockito.mock(TypedQuery.class);
+ Mockito.when(em.createQuery(Mockito.anyString(), Mockito.any())).thenReturn((TypedQuery<Object>) query);
// Mock backup monitor
PowerMockito.mockStatic(BackUpMonitor.class);
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsPushTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsPushTest.java
index 2b13640d2..2c76a2eff 100644
--- a/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsPushTest.java
+++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsPushTest.java
@@ -33,7 +33,7 @@ import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
-import javax.persistence.Query;
+import javax.persistence.TypedQuery;
import org.apache.maven.model.Dependency;
import org.junit.Rule;
@@ -65,8 +65,8 @@ public class BrmsPushTest {
PowerMockito.when(Persistence.createEntityManagerFactory(Mockito.any(), Mockito.any())).thenReturn(emf);
final EntityTransaction et = Mockito.mock(EntityTransaction.class);
Mockito.when(em.getTransaction()).thenReturn(et);
- final Query query = Mockito.mock(Query.class);
- Mockito.when(em.createQuery(Mockito.anyString())).thenReturn(query);
+ final TypedQuery<?> query = Mockito.mock(TypedQuery.class);
+ Mockito.when(em.createQuery(Mockito.anyString(), Mockito.any())).thenReturn((TypedQuery<Object>) query);
// Mock backup monitor
PowerMockito.mockStatic(BackUpMonitor.class);