From 5e19edb862d836c545a84e6f2b0b6006fbd76cc4 Mon Sep 17 00:00:00 2001 From: zhangab Date: Wed, 28 Mar 2018 21:28:10 +0800 Subject: improve sonar coverage for uui-server Change-Id: Ic5e1c55ee0060e5117b8407f76776c1470a913a3 Issue-ID: USECASEUI-103 Signed-off-by: zhangab --- .../server/service/impl/AlarmsHeaderServiceImplTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 mockUpQuery = new MockUp() { + }; MockUp mockedSession = new MockUp() { + @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() { + @Mock + private Session getSession() { + return mockedSession.getMockInstance(); + } + }; AlarmsHeaderServiceImpl alarmsHeaderServiceImpl = new AlarmsHeaderServiceImpl(); alarmsHeaderServiceImpl.saveAlarmsHeader(a); -- cgit 1.2.3-korg