aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhangab <zhanganbing@chinamobile.com>2018-03-28 21:28:10 +0800
committerzhangab <zhanganbing@chinamobile.com>2018-03-28 21:28:13 +0800
commit5e19edb862d836c545a84e6f2b0b6006fbd76cc4 (patch)
treeba6b402079690569a9680b8b70a115549efea341
parent595ae93a045011a568b764d3ac6574de0a351f19 (diff)
improve sonar coverage for uui-server
Change-Id: Ic5e1c55ee0060e5117b8407f76776c1470a913a3 Issue-ID: USECASEUI-103 Signed-off-by: zhangab <zhanganbing@chinamobile.com>
-rw-r--r--server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java b/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java
index e99ddae4..3d1c37a2 100644
--- a/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java
+++ b/server/src/test/java/org/onap/usecaseui/server/service/impl/AlarmsHeaderServiceImplTest.java
@@ -95,7 +95,16 @@ public class AlarmsHeaderServiceImplTest {
a.setUpdateTime(DateUtils.now());
a.setVersion("va2");
+
+
+
+ MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ };
MockUp<Session> mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String sql) {
+ return mockUpQuery.getMockInstance();
+ }
@Mock
public Transaction beginTransaction() {
return transaction;
@@ -112,6 +121,12 @@ public class AlarmsHeaderServiceImplTest {
public void commit() {
}
};
+ new MockUp<AlarmsHeaderServiceImpl>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
AlarmsHeaderServiceImpl alarmsHeaderServiceImpl = new AlarmsHeaderServiceImpl();
alarmsHeaderServiceImpl.saveAlarmsHeader(a);