X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=misc%2Fenv%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Faaf%2Fmisc%2Fenv%2Fjaxb%2FJU_JAXBDF.java;h=7952740b04f8be8615edc8bfc410b10e276cb583;hb=3d1706fcbe7f95830ff6fd23cf679ee55c6d0595;hp=62c490320553e4adcd63e9c796e817be3fccbcf0;hpb=321dce367d74092a0ba09930c3aa526abdbd5da8;p=aaf%2Fauthz.git diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java index 62c49032..7952740b 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java @@ -64,651 +64,651 @@ public class JU_JAXBDF { @Before public void setUp() { - initMocks(this); - tt=Mockito.mock(TimeTaken.class); - Mockito.doReturn(tt).when(env).start("JAXB Stringify", Env.XML); - Mockito.doNothing().when(tt).done(); - ttObjectify=Mockito.mock(TimeTaken.class); - Mockito.doReturn(ttObjectify).when(env).start("JAXB Objectify", Env.XML); - Mockito.doNothing().when(ttObjectify).done(); + initMocks(this); + tt=Mockito.mock(TimeTaken.class); + Mockito.doReturn(tt).when(env).start("JAXB Stringify", Env.XML); + Mockito.doNothing().when(tt).done(); + ttObjectify=Mockito.mock(TimeTaken.class); + Mockito.doReturn(ttObjectify).when(env).start("JAXB Objectify", Env.XML); + Mockito.doNothing().when(ttObjectify).done(); } @Test public void testNewInstance() { - JAXBDF bdfObj = null; - try { - bdfObj = new JAXBDF( null, new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - Mockito.doThrow(new IllegalAccessException("Test Exception")).when(bdfObj.jumar).newInstance(); - Object retVal = bdfObj.newInstance(); - } catch (IllegalAccessException e) { - assertEquals("Test Exception", e.getLocalizedMessage()); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } catch (InstantiationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - + JAXBDF bdfObj = null; + try { + bdfObj = new JAXBDF( null, new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + Mockito.doThrow(new IllegalAccessException("Test Exception")).when(bdfObj.jumar).newInstance(); + Object retVal = bdfObj.newInstance(); + } catch (IllegalAccessException e) { + assertEquals("Test Exception", e.getLocalizedMessage()); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } @Test public void testNewInstanceNoException() { - JAXBDF bdfObj = null; - try { - bdfObj = new JAXBDF( null, new Class[] {this.getClass()}); - Object retVal = bdfObj.newInstance(); - assertTrue(retVal instanceof JU_JAXBDF); - } catch (APIException e) { - e.printStackTrace(); - } - + JAXBDF bdfObj = null; + try { + bdfObj = new JAXBDF( null, new Class[] {this.getClass()}); + Object retVal = bdfObj.newInstance(); + assertTrue(retVal instanceof JU_JAXBDF); + } catch (APIException e) { + e.printStackTrace(); + } + } @Test public void testPrettyNoException() { - JAXBDF bdfObj = null; - try { - bdfObj = new JAXBDF( null, Mockito.mock(Schema.class), new Class[] {this.getClass()}); - Object retVal = bdfObj.pretty(true); - assertTrue(retVal instanceof JAXBDF); - } catch (APIException e) { - e.printStackTrace(); - } + JAXBDF bdfObj = null; + try { + bdfObj = new JAXBDF( null, Mockito.mock(Schema.class), new Class[] {this.getClass()}); + Object retVal = bdfObj.pretty(true); + assertTrue(retVal instanceof JAXBDF); + } catch (APIException e) { + e.printStackTrace(); + } } @Test public void testFragment() { - JAXBDF bdfObj = null; - try { - bdfObj = new JAXBDF( null, Mockito.mock(QName.class), new Class[] {this.getClass()}); - Object retVal = bdfObj.asFragment(true); - assertTrue(retVal instanceof JAXBDF); - bdfObj.servicePrestart(null); - bdfObj.threadPrestart(null); - bdfObj.refresh(null); - bdfObj.threadDestroy(null); - bdfObj.serviceDestroy(null); - } catch (APIException e) { - e.printStackTrace(); - } - + JAXBDF bdfObj = null; + try { + bdfObj = new JAXBDF( null, Mockito.mock(QName.class), new Class[] {this.getClass()}); + Object retVal = bdfObj.asFragment(true); + assertTrue(retVal instanceof JAXBDF); + bdfObj.servicePrestart(null); + bdfObj.threadPrestart(null); + bdfObj.refresh(null); + bdfObj.threadDestroy(null); + bdfObj.serviceDestroy(null); + } catch (APIException e) { + e.printStackTrace(); + } + } @Test public void testNewData() { - JAXBDF bdfObj = null; - try { - bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()}); - Data retVal = bdfObj.newData(); - assertTrue(retVal instanceof JAXBData); - } catch (APIException e) { - e.printStackTrace(); - } + JAXBDF bdfObj = null; + try { + bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()}); + Data retVal = bdfObj.newData(); + assertTrue(retVal instanceof JAXBData); + } catch (APIException e) { + e.printStackTrace(); + } } @Test public void testNewDataENV() { - JAXBDF bdfObj = null; - try { - bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()}); - Data retVal = bdfObj.newData(Mockito.mock(Env.class)); - assertTrue(retVal instanceof JAXBData); - } catch (APIException e) { - e.printStackTrace(); - } + JAXBDF bdfObj = null; + try { + bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()}); + Data retVal = bdfObj.newData(Mockito.mock(Env.class)); + assertTrue(retVal instanceof JAXBData); + } catch (APIException e) { + e.printStackTrace(); + } } @Test public void testNewDataType() { - JAXBDF bdfObj = null; - try { - bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()}); - Data retVal = bdfObj.newData(new JAXBumar(new Class[] {this.getClass()})); - assertTrue(retVal instanceof JAXBData); - } catch (APIException e) { - e.printStackTrace(); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + JAXBDF bdfObj = null; + try { + bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()}); + Data retVal = bdfObj.newData(new JAXBumar(new Class[] {this.getClass()})); + assertTrue(retVal instanceof JAXBData); + } catch (APIException e) { + e.printStackTrace(); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Test public void testNewDataStream() { - JAXBDF bdfObj = null; - try { - bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - InputStream is = Mockito.mock(InputStream.class); - Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, is); - Data retVal = bdfObj.newDataFromStream(env, is); - assertTrue(retVal instanceof JAXBData); - } catch (APIException e) { - e.printStackTrace(); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + JAXBDF bdfObj = null; + try { + bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + InputStream is = Mockito.mock(InputStream.class); + Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, is); + Data retVal = bdfObj.newDataFromStream(env, is); + assertTrue(retVal instanceof JAXBData); + } catch (APIException e) { + e.printStackTrace(); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Test public void testNewDataStreamException() { - JAXBDF bdfObj = null; - try { - bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - InputStream is = Mockito.mock(InputStream.class); - Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, is); - Data retVal = bdfObj.newDataFromStream(env, is); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - // TODO Auto-generated catch block - assertTrue(e.getMessage().contains("test")); - } + JAXBDF bdfObj = null; + try { + bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + InputStream is = Mockito.mock(InputStream.class); + Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, is); + Data retVal = bdfObj.newDataFromStream(env, is); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + // TODO Auto-generated catch block + assertTrue(e.getMessage().contains("test")); + } } @Test public void testNewDataFromString() { - JAXBDF bdfObj = null; - try { - bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()}); - Data retVal = bdfObj.newDataFromString("test"); - assertTrue(retVal instanceof JAXBData); - } catch (APIException e) { - e.printStackTrace(); - } + JAXBDF bdfObj = null; + try { + bdfObj = new JAXBDF( null, Mockito.mock(Schema.class),Mockito.mock(QName.class), new Class[] {this.getClass()}); + Data retVal = bdfObj.newDataFromString("test"); + assertTrue(retVal instanceof JAXBData); + } catch (APIException e) { + e.printStackTrace(); + } } @Test public void testStringify() { - JAXBDF bdfObj = null; - try { - JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - bdfObj.jmar = Mockito.mock(JAXBmar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(envJaxb).debug(); - Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(StringWriter.class)); - String retVal = bdfObj.stringify(typeObj); - assertEquals("", retVal); - } catch (APIException e) { - e.printStackTrace(); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + JAXBDF bdfObj = null; + try { + JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + bdfObj.jmar = Mockito.mock(JAXBmar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(envJaxb).debug(); + Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(StringWriter.class)); + String retVal = bdfObj.stringify(typeObj); + assertEquals("", retVal); + } catch (APIException e) { + e.printStackTrace(); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Test public void testStringifyException() { - JAXBDF bdfObj = null; - try { - JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(envJaxb).debug(); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - bdfObj.jmar = Mockito.mock(JAXBmar.class); - Mockito.doThrow(new JAXBException("test") ).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(StringWriter.class)); - String retVal = bdfObj.stringify(typeObj); - System.out.println(retVal); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } + JAXBDF bdfObj = null; + try { + JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(envJaxb).debug(); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + bdfObj.jmar = Mockito.mock(JAXBmar.class); + Mockito.doThrow(new JAXBException("test") ).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(StringWriter.class)); + String retVal = bdfObj.stringify(typeObj); + System.out.println(retVal); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } } @Test public void testStringifyWriter() { - JAXBDF bdfObj = null; - try { - JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - bdfObj.jmar = Mockito.mock(JAXBmar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(envJaxb).debug(); - Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(StringWriter.class)); - bdfObj.stringify(typeObj, Mockito.mock(StringWriter.class)); - } catch (APIException e) { - e.printStackTrace(); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + JAXBDF bdfObj = null; + try { + JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + bdfObj.jmar = Mockito.mock(JAXBmar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(envJaxb).debug(); + Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(StringWriter.class)); + bdfObj.stringify(typeObj, Mockito.mock(StringWriter.class)); + } catch (APIException e) { + e.printStackTrace(); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Test public void testStringifyWriterException() { - JAXBDF bdfObj = null; - try { - JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - bdfObj.jmar = Mockito.mock(JAXBmar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(envJaxb).debug(); - StringWriter sw = Mockito.mock(StringWriter.class); - Mockito.doThrow(new JAXBException("test")).when(bdfObj.jmar).marshal(logT, typeObj, sw); - bdfObj.stringify(typeObj, sw); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } + JAXBDF bdfObj = null; + try { + JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + bdfObj.jmar = Mockito.mock(JAXBmar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(envJaxb).debug(); + StringWriter sw = Mockito.mock(StringWriter.class); + Mockito.doThrow(new JAXBException("test")).when(bdfObj.jmar).marshal(logT, typeObj, sw); + bdfObj.stringify(typeObj, sw); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } } @Test public void testStringifyOS() { - JAXBDF bdfObj = null; - try { - JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - bdfObj.jmar = Mockito.mock(JAXBmar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(envJaxb).debug(); - Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(OutputStream.class)); - bdfObj.stringify(typeObj, Mockito.mock(OutputStream.class)); - } catch (APIException e) { - e.printStackTrace(); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + JAXBDF bdfObj = null; + try { + JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + bdfObj.jmar = Mockito.mock(JAXBmar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(envJaxb).debug(); + Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(OutputStream.class)); + bdfObj.stringify(typeObj, Mockito.mock(OutputStream.class)); + } catch (APIException e) { + e.printStackTrace(); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Test public void testStringifyOsException() { - JAXBDF bdfObj = null; - try { - JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - bdfObj.jmar = Mockito.mock(JAXBmar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(envJaxb).debug(); - OutputStream sw = Mockito.mock(OutputStream.class); - Mockito.doThrow(new JAXBException("test")).when(bdfObj.jmar).marshal(logT, typeObj, sw); - bdfObj.stringify(typeObj, sw); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } + JAXBDF bdfObj = null; + try { + JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + bdfObj.jmar = Mockito.mock(JAXBmar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(envJaxb).debug(); + OutputStream sw = Mockito.mock(OutputStream.class); + Mockito.doThrow(new JAXBException("test")).when(bdfObj.jmar).marshal(logT, typeObj, sw); + bdfObj.stringify(typeObj, sw); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } } @Test public void testStringifyOptions() { - JAXBDF bdfObj = null; - try { - JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - bdfObj.jmar = Mockito.mock(JAXBmar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(envJaxb).debug(); - Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(OutputStream.class)); - bdfObj.stringify(env, typeObj, true); - } catch (APIException e) { - e.printStackTrace(); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + JAXBDF bdfObj = null; + try { + JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + bdfObj.jmar = Mockito.mock(JAXBmar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(envJaxb).debug(); + Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(OutputStream.class)); + bdfObj.stringify(env, typeObj, true); + } catch (APIException e) { + e.printStackTrace(); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Test public void testStringifyOSOptions() { - JAXBDF bdfObj = null; - try { - JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - bdfObj.jmar = Mockito.mock(JAXBmar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(OutputStream.class),true); - bdfObj.stringify(env, typeObj, Mockito.mock(OutputStream.class),true); - } catch (APIException e) { - e.printStackTrace(); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + JAXBDF bdfObj = null; + try { + JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + bdfObj.jmar = Mockito.mock(JAXBmar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(OutputStream.class),true); + bdfObj.stringify(env, typeObj, Mockito.mock(OutputStream.class),true); + } catch (APIException e) { + e.printStackTrace(); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Test public void testStringifyOsOptionsException() { - JAXBDF bdfObj = null; - try { - JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - bdfObj.jmar = Mockito.mock(JAXBmar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - OutputStream sw = Mockito.mock(OutputStream.class); - Mockito.doThrow(new JAXBException("test")).when(bdfObj.jmar).marshal(logT, typeObj, sw,true); - bdfObj.stringify(env, typeObj, sw,true); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } + JAXBDF bdfObj = null; + try { + JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + bdfObj.jmar = Mockito.mock(JAXBmar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + OutputStream sw = Mockito.mock(OutputStream.class); + Mockito.doThrow(new JAXBException("test")).when(bdfObj.jmar).marshal(logT, typeObj, sw,true); + bdfObj.stringify(env, typeObj, sw,true); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } } @Test public void testStringifySWOptions() { - JAXBDF bdfObj = null; - try { - JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - bdfObj.jmar = Mockito.mock(JAXBmar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(StringWriter.class),true); - bdfObj.stringify(env, typeObj, Mockito.mock(StringWriter.class),true); - } catch (APIException e) { - e.printStackTrace(); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + JAXBDF bdfObj = null; + try { + JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + bdfObj.jmar = Mockito.mock(JAXBmar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + Mockito.doReturn(this.getClass()).when(bdfObj.jmar).marshal(logT, typeObj, Mockito.mock(StringWriter.class),true); + bdfObj.stringify(env, typeObj, Mockito.mock(StringWriter.class),true); + } catch (APIException e) { + e.printStackTrace(); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Test public void testStringifySWOptionsException() { - JAXBDF bdfObj = null; - try { - JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - bdfObj.jmar = Mockito.mock(JAXBmar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - StringWriter sw = Mockito.mock(StringWriter.class); - Mockito.doThrow(new JAXBException("test")).when(bdfObj.jmar).marshal(logT, typeObj, sw,true); - bdfObj.stringify(env, typeObj, sw,true); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } + JAXBDF bdfObj = null; + try { + JAXBmar typeObj = new JAXBmar(new Class[] {this.getClass()}); + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + bdfObj.jmar = Mockito.mock(JAXBmar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + StringWriter sw = Mockito.mock(StringWriter.class); + Mockito.doThrow(new JAXBException("test")).when(bdfObj.jmar).marshal(logT, typeObj, sw,true); + bdfObj.stringify(env, typeObj, sw,true); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } } @Test public void testObjectifyEnv() { - JAXBDF bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(StringReader.class)); - - bdfObj.objectify(env, Mockito.mock(StringReader.class)); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(StringReader.class)); + + bdfObj.objectify(env, Mockito.mock(StringReader.class)); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } + } @Test public void testObjectifyEnvException() { - JAXBDF bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - StringReader sr = Mockito.mock(StringReader.class); - Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr); - - bdfObj.objectify(env, sr); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + StringReader sr = Mockito.mock(StringReader.class); + Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr); + + bdfObj.objectify(env, sr); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } + } @Test public void testObjectifyRdr() { - JAXBDF bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(StringReader.class)); - - bdfObj.objectify( Mockito.mock(StringReader.class)); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(StringReader.class)); + + bdfObj.objectify( Mockito.mock(StringReader.class)); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } + } @Test public void testObjectifyRdrException() { - JAXBDF bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(envJaxb).debug(); - StringReader sr = Mockito.mock(StringReader.class); - Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr); - - bdfObj.objectify(sr); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(envJaxb).debug(); + StringReader sr = Mockito.mock(StringReader.class); + Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr); + + bdfObj.objectify(sr); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } + } @Test public void testObjectifyEnvIS() { - JAXBDF bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(InputStream.class)); - - bdfObj.objectify(env, Mockito.mock(InputStream.class)); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(InputStream.class)); + + bdfObj.objectify(env, Mockito.mock(InputStream.class)); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } + } @Test public void testObjectifyEnvISException() { - JAXBDF bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - InputStream sr = Mockito.mock(InputStream.class); - Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr); - - bdfObj.objectify(env, sr); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + InputStream sr = Mockito.mock(InputStream.class); + Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr); + + bdfObj.objectify(env, sr); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } + } @Test public void testObjectifyIs() { - JAXBDF bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(InputStream.class)); - - bdfObj.objectify( Mockito.mock(InputStream.class)); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(InputStream.class)); + + bdfObj.objectify( Mockito.mock(InputStream.class)); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } + } @Test public void testObjectifyIsException() { - JAXBDF bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(envJaxb).debug(); - InputStream sr = Mockito.mock(InputStream.class); - Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr); - - bdfObj.objectify(sr); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(envJaxb).debug(); + InputStream sr = Mockito.mock(InputStream.class); + Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr); + + bdfObj.objectify(sr); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } + } @Test public void testObjectifyEnvStr() { - JAXBDF bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, "test"); - - bdfObj.objectify(env, "test"); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, "test"); + + bdfObj.objectify(env, "test"); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } + } @Test public void testObjectifyEnvStrException() { - JAXBDF bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - InputStream sr = Mockito.mock(InputStream.class); - Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, "test"); - - bdfObj.objectify(env, "test"); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + InputStream sr = Mockito.mock(InputStream.class); + Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, "test"); + + bdfObj.objectify(env, "test"); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } + } @Test public void testObjectifyStr() { - JAXBDF bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, "test"); - - bdfObj.objectify( "test"); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, "test"); + + bdfObj.objectify( "test"); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } + } @Test public void testObjectifyStrException() { - JAXBDF bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); - bdfObj.jumar = Mockito.mock(JAXBumar.class); - LogTarget logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(envJaxb).debug(); - InputStream sr = Mockito.mock(InputStream.class); - Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, "test"); - - bdfObj.objectify("test"); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } catch (JAXBException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + JAXBumar typeObj = new JAXBumar(new Class[] {this.getClass()}); + bdfObj.jumar = Mockito.mock(JAXBumar.class); + LogTarget logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(envJaxb).debug(); + InputStream sr = Mockito.mock(InputStream.class); + Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, "test"); + + bdfObj.objectify("test"); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } catch (JAXBException e) { + assertTrue(e.getMessage().contains("test")); + } + } @Test public void testTypeClass() { - JAXBDF bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - - Object obj = bdfObj.getTypeClass(); - assertFalse(obj instanceof JU_JAXBDF); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); + + Object obj = bdfObj.getTypeClass(); + assertFalse(obj instanceof JU_JAXBDF); + } catch (APIException e) { + assertTrue(e.getMessage().contains("test")); + } + } }