From 89e8b994334df1611c21a77eaf084ac8f3e038bb Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Mon, 20 Aug 2018 16:16:29 +0530 Subject: [PATCH 1/1] removed try catch from test case & formatted code replaced try catch with @Test(expected=JAXBException.class) Issue-ID: APPC-1086 Change-Id: Ie3ec5a60b4ac09797ce2a8e5ed2f79b2979875c1 Signed-off-by: Sandeep J --- .../onap/appc/dg/common/utils/JAXBUtilTest.java | 27 +++++++--------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/utils/JAXBUtilTest.java b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/utils/JAXBUtilTest.java index f0e525b53..b5adc5d3f 100644 --- a/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/utils/JAXBUtilTest.java +++ b/appc-dg/appc-dg-shared/appc-dg-common/src/test/java/org/onap/appc/dg/common/utils/JAXBUtilTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright 2018 AT&T *================================================================================= +* Modifications Copyright 2018 AT&T +*================================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,30 +21,17 @@ */ package org.onap.appc.dg.common.utils; -import static org.junit.Assert.assertEquals; +import javax.xml.bind.JAXBException; -import org.junit.Before; import org.junit.Test; - - -import javax.xml.bind.JAXBException; - public class JAXBUtilTest { + + @Test(expected = JAXBException.class) + public void testToObjectFail() throws Exception { + String xmlStr = "I1T1"; + JAXBUtil.toObject(xmlStr, JSONUtilVnfTest.class); - @Before - public void setUp() { - } - - @Test - public void testToObjectFail() { - String xmlStr = "I1T1"; - JSONUtilVnfTest jOut = null; - try { - jOut = JAXBUtil.toObject(xmlStr, JSONUtilVnfTest.class); - } catch (JAXBException jaxbe) { - assertEquals(jOut, null); - } } } -- 2.16.6