diff options
author | 2018-03-27 17:24:06 +0800 | |
---|---|---|
committer | 2018-03-27 17:24:09 +0800 | |
commit | 565fc0c853537fc1afd0966e59e663c869d83247 (patch) | |
tree | 00302536143cd43113632af422c0d2d866f86b24 | |
parent | 3d9adc3b8665af8e704a6bcd1a2d1c27aae6d9d2 (diff) |
improve sonar coverage for uui-server
Change-Id: I544aa10ff52dee9c7631ccd185233ea15c2957c5
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.java | 21 |
1 files changed, 7 insertions, 14 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 cc267548..30c87b9a 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 @@ -31,8 +31,6 @@ import org.springframework.test.context.web.WebAppConfiguration; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; -import org.hibernate.*; -import org.hibernate.cfg.*; /** * AlarmsHeaderServiceImpl Tester. @@ -41,18 +39,19 @@ import org.hibernate.cfg.*; * @since <pre>8, 2018</pre> * @version 1.0 */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(classes = UsecaseuiServerApplication.class) +@WebAppConfiguration public class AlarmsHeaderServiceImplTest { - - private static SessionFactory sessionFactory; + @Autowired + private AlarmsHeaderServiceImpl alarmsHeaderServiceImpl; @Before public void before() throws Exception { - sessionFactory = new Configuration().configure().buildSessionFactory(); } @After -public void after() throws Exception { - sessionFactory.close(); +public void after() throws Exception { } /** @@ -90,15 +89,9 @@ public void testSaveAlarmsHeader() throws Exception { a.setStartEpochMicrosec("wallet"); a.setUpdateTime(DateUtils.now()); a.setVersion("va2"); - AlarmsHeaderServiceImpl alarmsHeaderServiceImpl = new AlarmsHeaderServiceImpl(); + alarmsHeaderServiceImpl = new AlarmsHeaderServiceImpl(); System.out.println(alarmsHeaderServiceImpl.saveAlarmsHeader(a)); } -@Test -public void testQueryStatusCount() throws Exception { - AlarmsHeaderServiceImpl alarmsHeaderServiceImpl = new AlarmsHeaderServiceImpl(); - String str =alarmsHeaderServiceImpl.queryStatusCount("close"); - System.out.println("str ="+str); -} } |