From 3d1706fcbe7f95830ff6fd23cf679ee55c6d0595 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Wed, 7 Aug 2019 13:40:39 -0500 Subject: Remove Tabs, per Jococo Issue-ID: AAF-932 Change-Id: I3ab0ebcc082048d2d1424a58a90ea479fb005ee6 Signed-off-by: Instrumental --- .../main/java/org/onap/aaf/misc/env/LogTarget.java | 30 +- .../main/java/org/onap/aaf/misc/env/TimeTaken.java | 2 +- .../java/org/onap/aaf/misc/env/impl/AbsTrans.java | 12 +- .../org/onap/aaf/misc/env/JU_BaseDataFactory.java | 98 +- .../onap/aaf/misc/env/JU_JavaUtilLogTarget.java | 42 +- .../org/onap/aaf/misc/env/JU_LogTargetTest.java | 8 +- .../org/onap/aaf/misc/env/JU_NullLifeCycle.java | 20 +- .../org/onap/aaf/misc/env/impl/JU_AbsTrans.java | 478 ++++----- .../onap/aaf/misc/env/impl/JU_AbsTransJaxb.java | 264 ++--- .../aaf/misc/env/impl/JU_Log4JLogTargetTest.java | 84 +- .../java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java | 1034 ++++++++++---------- .../aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java | 310 +++--- .../aaf/misc/env/jaxb/JU_JAXBStringifierTest.java | 248 ++--- .../onap/aaf/misc/env/jaxb/JU_StoreImplTest.java | 178 ++-- 14 files changed, 1404 insertions(+), 1404 deletions(-) (limited to 'misc/env/src') diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java b/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java index 84eb5ee6..a98d7100 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/LogTarget.java @@ -69,18 +69,18 @@ public interface LogTarget { public static final LogTarget SYSERR = new StreamLogTarget(System.err,false); public static class StreamLogTarget implements LogTarget { - private final PrintStream out; - private final boolean closeMe; - - public StreamLogTarget(PrintStream ps) { - this(ps,true); - } - - /* Do NOT close SYSTEM ERR or OUT*/ - protected StreamLogTarget(PrintStream ps, boolean shouldClose) { - out = ps; - closeMe = shouldClose; - } + private final PrintStream out; + private final boolean closeMe; + + public StreamLogTarget(PrintStream ps) { + this(ps,true); + } + + /* Do NOT close SYSTEM ERR or OUT*/ + protected StreamLogTarget(PrintStream ps, boolean shouldClose) { + out = ps; + closeMe = shouldClose; + } public void log(Object ... msgs) { out.print(Chrono.dateFmt.format(new Date())); out.print(": "); @@ -117,9 +117,9 @@ public interface LogTarget { } public void close() { - if(closeMe) { - out.close(); - } + if(closeMe) { + out.close(); + } } } diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/TimeTaken.java b/misc/env/src/main/java/org/onap/aaf/misc/env/TimeTaken.java index 58c588f6..2491e16c 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/TimeTaken.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/TimeTaken.java @@ -78,7 +78,7 @@ public abstract class TimeTaken { } - /** + /** * For sizable contents, set the size. Implementations can simply write a no-op if they don't wish to * store the size. * diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/AbsTrans.java b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/AbsTrans.java index 5ba74369..9edd3bf4 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/impl/AbsTrans.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/impl/AbsTrans.java @@ -131,11 +131,11 @@ public abstract class AbsTrans implements TransStore { //long end = (first.flag&SUB)==SUB?first.end():trail.get(last).end(); long end = 0L; for(int i=last;end==0L && i>=0;--i) { - end= trail.get(i).end(); + end= trail.get(i).end(); } metric.total = (end - first.start) / 1000000f; } else { - metric.total=0L; + metric.total=0L; } if (sb==null) { @@ -170,14 +170,14 @@ public abstract class AbsTrans implements TransStore { sb.append(" "); } if((tt.flag & CHECKPOINT)==CHECKPOINT) { - // Checkpoint - sb.append(" "); + // Checkpoint + sb.append(" "); } else { - float ms=tt.millis(); + float ms=tt.millis(); // Add time values to Metric for (int i=0;i T get(StaticSlot slot, T dflt) { - // TODO Auto-generated method stub - return null; - } + @Override + public T get(StaticSlot slot, T dflt) { + // TODO Auto-generated method stub + return null; + } - @Override - public String setProperty(String tag, String value) { - // TODO Auto-generated method stub - return null; - } + @Override + public String setProperty(String tag, String value) { + // TODO Auto-generated method stub + return null; + } - @Override - public String getProperty(String tag) { - // TODO Auto-generated method stub - return null; - } + @Override + public String getProperty(String tag) { + // TODO Auto-generated method stub + return null; + } - @Override - public String getProperty(String tag, String deflt) { - // TODO Auto-generated method stub - return null; - } + @Override + public String getProperty(String tag, String deflt) { + // TODO Auto-generated method stub + return null; + } - @Override - public Decryptor decryptor() { - // TODO Auto-generated method stub - return null; - } + @Override + public Decryptor decryptor() { + // TODO Auto-generated method stub + return null; + } - @Override - public Encryptor encryptor() { - // TODO Auto-generated method stub - return null; - } + @Override + public Encryptor encryptor() { + // TODO Auto-generated method stub + return null; + } - @Override - protected TimeTaken newTimeTaken(String name, int flag, Object ... values) { - // TODO Auto-generated method stub - return new TimeTaken("nameTest", Env.XML) { - - @Override - public void output(StringBuilder sb) { - // TODO Auto-generated method stub - - } - }; - } - - } - - @Test - public void testFatal() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - Mockito.doReturn(lt).when(delegate).fatal(); - LogTarget lt = absTransObj.fatal(); - assertTrue(lt instanceof LogTarget); - } - - @Test - public void testError() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - Mockito.doReturn(lt).when(delegate).error(); - LogTarget lt = absTransObj.error(); - assertTrue(lt instanceof LogTarget); - } - - @Test - public void testAudit() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - Mockito.doReturn(lt).when(delegate).audit(); - LogTarget lt = absTransObj.audit(); - assertTrue(lt instanceof LogTarget); - } + @Override + protected TimeTaken newTimeTaken(String name, int flag, Object ... values) { + // TODO Auto-generated method stub + return new TimeTaken("nameTest", Env.XML) { + + @Override + public void output(StringBuilder sb) { + // TODO Auto-generated method stub + + } + }; + } + + } + + @Test + public void testFatal() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + Mockito.doReturn(lt).when(delegate).fatal(); + LogTarget lt = absTransObj.fatal(); + assertTrue(lt instanceof LogTarget); + } + + @Test + public void testError() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + Mockito.doReturn(lt).when(delegate).error(); + LogTarget lt = absTransObj.error(); + assertTrue(lt instanceof LogTarget); + } + + @Test + public void testAudit() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + Mockito.doReturn(lt).when(delegate).audit(); + LogTarget lt = absTransObj.audit(); + assertTrue(lt instanceof LogTarget); + } - @Test - public void testInit() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - Mockito.doReturn(lt).when(delegate).init(); - LogTarget lt = absTransObj.init(); - assertTrue(lt instanceof LogTarget); - } - - @Test - public void testWarn() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - Mockito.doReturn(lt).when(delegate).warn(); - LogTarget lt = absTransObj.warn(); - assertTrue(lt instanceof LogTarget); - } - - @Test - public void testInfo() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - Mockito.doReturn(lt).when(delegate).info(); - LogTarget lt = absTransObj.info(); - assertTrue(lt instanceof LogTarget); - } - - @Test - public void testDebug() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - Mockito.doReturn(lt).when(delegate).debug(); - LogTarget lt = absTransObj.debug(); - assertTrue(lt instanceof LogTarget); - } - - @Test - public void testTrace() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - Mockito.doReturn(lt).when(delegate).trace(); - LogTarget lt = absTransObj.trace(); - assertTrue(lt instanceof LogTarget); - } - - @Test - public void testStart() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - TimeTaken lt = absTransObj.start("test",1); - assertEquals("nameTest", lt.name); - } - - @Test - public void testCheckpint() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - absTransObj.checkpoint("test"); - assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); - } - - @Test - public void testCheckpintAddFlag() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - absTransObj.checkpoint("test",1); - assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); - } - - @Test - public void testAuditTrailWithEmptyTrail() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - Mockito.doReturn(lt).when(delegate).info(); - Mockito.doReturn(true).when(lt).isLoggable(); - absTransObj.auditTrail(1, new StringBuilder(), 1); - //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); - } - - @Test - public void testAuditTrail() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - Mockito.doReturn(lt).when(delegate).info(); - Mockito.doReturn(true).when(lt).isLoggable(); - TimeTaken tt=absTransObj.newTimeTaken("test", 1); - absTransObj.trail.add(tt); - absTransObj.trail.add(tt); - absTransObj.trail.add(tt); - absTransObj.auditTrail(1, new StringBuilder(), 2); - //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); - } - - @Test - public void testAuditTrailLoggableFalse() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - Mockito.doReturn(lt).when(delegate).info(); - Mockito.doReturn(false).when(lt).isLoggable(); - TimeTaken tt=absTransObj.newTimeTaken("test", 1); - absTransObj.trail.add(tt); - absTransObj.trail.add(tt); - absTransObj.trail.add(tt); - absTransObj.auditTrail(1, new StringBuilder(), 1); - //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); - } - - @Test - public void testAuditTrailNullSB() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - Mockito.doReturn(lt).when(delegate).info(); - Mockito.doReturn(true).when(lt).isLoggable(); - TimeTaken tt=absTransObj.newTimeTaken("test", 1); - absTransObj.trail.add(tt); - absTransObj.trail.add(tt); - absTransObj.trail.add(tt); - absTransObj.auditTrail(1, null, 1); - //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); - } - - @Test - public void testAuditTrailEmpptyFlag() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate); - Mockito.doReturn(lt).when(delegate).info(); - Mockito.doReturn(true).when(lt).isLoggable(); - TimeTaken tt=absTransObj.newTimeTaken("test", 1); - absTransObj.trail.add(tt); - absTransObj.trail.add(tt); - absTransObj.trail.add(tt); - absTransObj.auditTrail(1, null, new int[] {}); - //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); - } - - @Test - public void testPut() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate1); - try { - absTransObj.put(absTransObj.slot("test"), "test"); - } catch(Exception e){ - assertTrue(e instanceof NullPointerException); - } - } - - @Test - public void testGet() { - AbsTransImpl absTransObj = new AbsTransImpl(delegate1); - try { - absTransObj.get(absTransObj.slot("test"), "test"); - } catch(Exception e){ - e.printStackTrace(); - assertTrue(e instanceof NullPointerException); - } - } + @Test + public void testInit() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + Mockito.doReturn(lt).when(delegate).init(); + LogTarget lt = absTransObj.init(); + assertTrue(lt instanceof LogTarget); + } + + @Test + public void testWarn() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + Mockito.doReturn(lt).when(delegate).warn(); + LogTarget lt = absTransObj.warn(); + assertTrue(lt instanceof LogTarget); + } + + @Test + public void testInfo() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + Mockito.doReturn(lt).when(delegate).info(); + LogTarget lt = absTransObj.info(); + assertTrue(lt instanceof LogTarget); + } + + @Test + public void testDebug() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + Mockito.doReturn(lt).when(delegate).debug(); + LogTarget lt = absTransObj.debug(); + assertTrue(lt instanceof LogTarget); + } + + @Test + public void testTrace() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + Mockito.doReturn(lt).when(delegate).trace(); + LogTarget lt = absTransObj.trace(); + assertTrue(lt instanceof LogTarget); + } + + @Test + public void testStart() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + TimeTaken lt = absTransObj.start("test",1); + assertEquals("nameTest", lt.name); + } + + @Test + public void testCheckpint() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + absTransObj.checkpoint("test"); + assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); + } + + @Test + public void testCheckpintAddFlag() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + absTransObj.checkpoint("test",1); + assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); + } + + @Test + public void testAuditTrailWithEmptyTrail() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + Mockito.doReturn(lt).when(delegate).info(); + Mockito.doReturn(true).when(lt).isLoggable(); + absTransObj.auditTrail(1, new StringBuilder(), 1); + //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); + } + + @Test + public void testAuditTrail() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + Mockito.doReturn(lt).when(delegate).info(); + Mockito.doReturn(true).when(lt).isLoggable(); + TimeTaken tt=absTransObj.newTimeTaken("test", 1); + absTransObj.trail.add(tt); + absTransObj.trail.add(tt); + absTransObj.trail.add(tt); + absTransObj.auditTrail(1, new StringBuilder(), 2); + //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); + } + + @Test + public void testAuditTrailLoggableFalse() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + Mockito.doReturn(lt).when(delegate).info(); + Mockito.doReturn(false).when(lt).isLoggable(); + TimeTaken tt=absTransObj.newTimeTaken("test", 1); + absTransObj.trail.add(tt); + absTransObj.trail.add(tt); + absTransObj.trail.add(tt); + absTransObj.auditTrail(1, new StringBuilder(), 1); + //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); + } + + @Test + public void testAuditTrailNullSB() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + Mockito.doReturn(lt).when(delegate).info(); + Mockito.doReturn(true).when(lt).isLoggable(); + TimeTaken tt=absTransObj.newTimeTaken("test", 1); + absTransObj.trail.add(tt); + absTransObj.trail.add(tt); + absTransObj.trail.add(tt); + absTransObj.auditTrail(1, null, 1); + //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); + } + + @Test + public void testAuditTrailEmpptyFlag() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate); + Mockito.doReturn(lt).when(delegate).info(); + Mockito.doReturn(true).when(lt).isLoggable(); + TimeTaken tt=absTransObj.newTimeTaken("test", 1); + absTransObj.trail.add(tt); + absTransObj.trail.add(tt); + absTransObj.trail.add(tt); + absTransObj.auditTrail(1, null, new int[] {}); + //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); + } + + @Test + public void testPut() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate1); + try { + absTransObj.put(absTransObj.slot("test"), "test"); + } catch(Exception e){ + assertTrue(e instanceof NullPointerException); + } + } + + @Test + public void testGet() { + AbsTransImpl absTransObj = new AbsTransImpl(delegate1); + try { + absTransObj.get(absTransObj.slot("test"), "test"); + } catch(Exception e){ + e.printStackTrace(); + assertTrue(e instanceof NullPointerException); + } + } } \ No newline at end of file diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTransJaxb.java b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTransJaxb.java index 22d979fe..f8b32451 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTransJaxb.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTransJaxb.java @@ -42,136 +42,136 @@ import org.onap.aaf.misc.env.TimeTaken; public class JU_AbsTransJaxb { - @Mock - EnvJAXB delegate; - - @Mock - LogTarget lt; - - @Before - public void setUp() { - initMocks(this); - } - - class AbsTransJAXBImpl extends AbsTransJAXB{ - - public AbsTransJAXBImpl(EnvJAXB env) { - super(env); - // TODO Auto-generated constructor stub - } - - @Override - public String setProperty(String tag, String value) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getProperty(String tag) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getProperty(String tag, String deflt) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Decryptor decryptor() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Encryptor encryptor() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Slot slot(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public T get(StaticSlot slot, T dflt) { - // TODO Auto-generated method stub - return null; - } - - @Override - protected TimeTaken newTimeTaken(String name, int flag, Object ... values) { - // TODO Auto-generated method stub - return null; - } - - - } - - - @Test - public void testNewDataFactory() { - AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate); - DataFactory lt = null; - - try { - Mockito.doReturn(lt).when(delegate).newDataFactory(new Class[] {AbsTransJAXB.class}); - lt = absTransObj.newDataFactory(new Class[] {AbsTransJAXB.class}); - } catch (APIException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - //assertTrue(lt instanceof LogTarget); - } - - @Test - public void testNewDataFactorySchema() { - AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate); - DataFactory lt = null; - Schema schema = Mockito.mock(Schema.class); - try { - Mockito.doReturn(lt).when(delegate).newDataFactory(schema, new Class[] {AbsTransJAXB.class}); - lt = absTransObj.newDataFactory(schema, new Class[] {AbsTransJAXB.class}); - } catch (APIException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - //assertTrue(lt instanceof LogTarget); - } - - @Test - public void testNewDataFactoryQname() { - AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate); - DataFactory lt = null; - QName schema = Mockito.mock(QName.class); - try { - Mockito.doReturn(lt).when(delegate).newDataFactory(schema, new Class[] {AbsTransJAXB.class}); - lt = absTransObj.newDataFactory(schema, new Class[] {AbsTransJAXB.class}); - } catch (APIException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - //assertTrue(lt instanceof LogTarget); - } - - @Test - public void testNewDataFactorySchemaQname() { - AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate); - DataFactory lt = null; - QName qname = Mockito.mock(QName.class); - Schema schema = Mockito.mock(Schema.class); - try { - Mockito.doReturn(lt).when(delegate).newDataFactory(schema, qname,new Class[] {AbsTransJAXB.class}); - lt = absTransObj.newDataFactory(schema, qname,new Class[] {AbsTransJAXB.class}); - } catch (APIException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - //assertTrue(lt instanceof LogTarget); - } - - + @Mock + EnvJAXB delegate; + + @Mock + LogTarget lt; + + @Before + public void setUp() { + initMocks(this); + } + + class AbsTransJAXBImpl extends AbsTransJAXB{ + + public AbsTransJAXBImpl(EnvJAXB env) { + super(env); + // TODO Auto-generated constructor stub + } + + @Override + public String setProperty(String tag, String value) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getProperty(String tag) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getProperty(String tag, String deflt) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Decryptor decryptor() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Encryptor encryptor() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Slot slot(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public T get(StaticSlot slot, T dflt) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected TimeTaken newTimeTaken(String name, int flag, Object ... values) { + // TODO Auto-generated method stub + return null; + } + + + } + + + @Test + public void testNewDataFactory() { + AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate); + DataFactory lt = null; + + try { + Mockito.doReturn(lt).when(delegate).newDataFactory(new Class[] {AbsTransJAXB.class}); + lt = absTransObj.newDataFactory(new Class[] {AbsTransJAXB.class}); + } catch (APIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //assertTrue(lt instanceof LogTarget); + } + + @Test + public void testNewDataFactorySchema() { + AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate); + DataFactory lt = null; + Schema schema = Mockito.mock(Schema.class); + try { + Mockito.doReturn(lt).when(delegate).newDataFactory(schema, new Class[] {AbsTransJAXB.class}); + lt = absTransObj.newDataFactory(schema, new Class[] {AbsTransJAXB.class}); + } catch (APIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //assertTrue(lt instanceof LogTarget); + } + + @Test + public void testNewDataFactoryQname() { + AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate); + DataFactory lt = null; + QName schema = Mockito.mock(QName.class); + try { + Mockito.doReturn(lt).when(delegate).newDataFactory(schema, new Class[] {AbsTransJAXB.class}); + lt = absTransObj.newDataFactory(schema, new Class[] {AbsTransJAXB.class}); + } catch (APIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //assertTrue(lt instanceof LogTarget); + } + + @Test + public void testNewDataFactorySchemaQname() { + AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate); + DataFactory lt = null; + QName qname = Mockito.mock(QName.class); + Schema schema = Mockito.mock(Schema.class); + try { + Mockito.doReturn(lt).when(delegate).newDataFactory(schema, qname,new Class[] {AbsTransJAXB.class}); + lt = absTransObj.newDataFactory(schema, qname,new Class[] {AbsTransJAXB.class}); + } catch (APIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + //assertTrue(lt instanceof LogTarget); + } + + } \ No newline at end of file diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java index 6900d9ed..fe72d01e 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java @@ -34,75 +34,75 @@ import org.onap.aaf.misc.env.APIException; public class JU_Log4JLogTargetTest { - @Mock - Level level; - + @Mock + Level level; + @Mock Logger log; @Before public void setup() { - initMocks(this); + initMocks(this); } @Test public void testLoggable() { - Log4JLogTarget logObj = null; - try { - logObj = new Log4JLogTarget( "testLogger", Level.DEBUG); - } catch (APIException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - boolean retVal = logObj.isLoggable(); + Log4JLogTarget logObj = null; + try { + logObj = new Log4JLogTarget( "testLogger", Level.DEBUG); + } catch (APIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + boolean retVal = logObj.isLoggable(); assertTrue(retVal); } @Test public void testLog() { - Log4JLogTarget logObj = null; - try { - logObj = new Log4JLogTarget( null, Level.DEBUG); - } catch (APIException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - logObj.log(new Object[] {"test"}); + Log4JLogTarget logObj = null; + try { + logObj = new Log4JLogTarget( null, Level.DEBUG); + } catch (APIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + logObj.log(new Object[] {"test"}); } @Test public void testLogThrowable() { - Log4JLogTarget logObj = null; - try { - logObj = new Log4JLogTarget( null, Level.DEBUG); - } catch (APIException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - logObj.log(new Throwable("test exception"), new Object[] {"test","test2","",null}); + Log4JLogTarget logObj = null; + try { + logObj = new Log4JLogTarget( null, Level.DEBUG); + } catch (APIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + logObj.log(new Throwable("test exception"), new Object[] {"test","test2","",null}); } @Test public void testPrintf() { - Log4JLogTarget logObj = null; - try { - logObj = new Log4JLogTarget( "", level); - } catch (APIException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - logObj.printf("test", new Object[] {"test","test2",""}); + Log4JLogTarget logObj = null; + try { + logObj = new Log4JLogTarget( "", level); + } catch (APIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + logObj.printf("test", new Object[] {"test","test2",""}); } @Test public void testSetEnv() { - try { - Log4JLogTarget.setLog4JEnv("test", Mockito.mock(BasicEnv.class)); - } catch (APIException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + try { + Log4JLogTarget.setLog4JEnv("test", Mockito.mock(BasicEnv.class)); + } catch (APIException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } } \ No newline at end of file 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")); + } + } } diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java index 46feebb1..9330f18b 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java @@ -41,178 +41,178 @@ import org.onap.aaf.misc.env.TimeTaken; public class JU_JAXBObjectifierTest { - @Mock - JAXBumar jumar; - - @Mock - Schema schema; - - @Mock - Env env; - - TimeTaken tt,ttObjectify; - - LogTarget logT; - - @Before - public void setUp() { - initMocks(this); - tt=Mockito.mock(TimeTaken.class); - Mockito.doReturn(tt).when(env).start("JAXB Unmarshal", Env.XML); - Mockito.doNothing().when(tt).done(); - logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - } + @Mock + JAXBumar jumar; + + @Mock + Schema schema; + + @Mock + Env env; + + TimeTaken tt,ttObjectify; + + LogTarget logT; + + @Before + public void setUp() { + initMocks(this); + tt=Mockito.mock(TimeTaken.class); + Mockito.doReturn(tt).when(env).start("JAXB Unmarshal", Env.XML); + Mockito.doNothing().when(tt).done(); + logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + } - @Test + @Test public void testObjectify() { - JAXBObjectifier bdfObj = null; - try { - bdfObj = new JAXBObjectifier( schema, new Class[] {this.getClass()}); - bdfObj = new JAXBObjectifier(jumar); - Mockito.doReturn(this.getClass()).when(jumar).unmarshal(logT, "test"); - bdfObj.objectify(env, "test"); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - + JAXBObjectifier bdfObj = null; + try { + bdfObj = new JAXBObjectifier( schema, new Class[] {this.getClass()}); + bdfObj = new JAXBObjectifier(jumar); + Mockito.doReturn(this.getClass()).when(jumar).unmarshal(logT, "test"); + bdfObj.objectify(env, "test"); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - - @Test + + @Test public void testObjectifyException() { - JAXBObjectifier bdfObj = null; - try { - bdfObj = new JAXBObjectifier(jumar); - Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).unmarshal(logT, "test"); - bdfObj.objectify(env, "test"); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - + JAXBObjectifier bdfObj = null; + try { + bdfObj = new JAXBObjectifier(jumar); + Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).unmarshal(logT, "test"); + bdfObj.objectify(env, "test"); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - - @Test + + @Test public void testObjectifyRdr() { - JAXBObjectifier bdfObj = null; - try { - bdfObj = new JAXBObjectifier(new Class[] {this.getClass()}); - bdfObj = new JAXBObjectifier(jumar); - Mockito.doReturn(this.getClass()).when(jumar).unmarshal(logT, Mockito.mock(StringReader.class)); - bdfObj.objectify(env, Mockito.mock(StringReader.class)); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - + JAXBObjectifier bdfObj = null; + try { + bdfObj = new JAXBObjectifier(new Class[] {this.getClass()}); + bdfObj = new JAXBObjectifier(jumar); + Mockito.doReturn(this.getClass()).when(jumar).unmarshal(logT, Mockito.mock(StringReader.class)); + bdfObj.objectify(env, Mockito.mock(StringReader.class)); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - - @Test + + @Test public void testObjectifyRdrException() { - JAXBObjectifier bdfObj = null; - try { - bdfObj = new JAXBObjectifier(jumar); - StringReader sr = Mockito.mock(StringReader.class); - Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).unmarshal(logT, sr); - bdfObj.objectify(env, sr); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - + JAXBObjectifier bdfObj = null; + try { + bdfObj = new JAXBObjectifier(jumar); + StringReader sr = Mockito.mock(StringReader.class); + Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).unmarshal(logT, sr); + bdfObj.objectify(env, sr); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - - @Test + + @Test public void testObjectifyIs() { - JAXBObjectifier bdfObj = null; - try { - bdfObj = new JAXBObjectifier(jumar); - Mockito.doReturn(this.getClass()).when(jumar).unmarshal(logT, Mockito.mock(InputStream.class)); - bdfObj.objectify(env, Mockito.mock(InputStream.class)); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - + JAXBObjectifier bdfObj = null; + try { + bdfObj = new JAXBObjectifier(jumar); + Mockito.doReturn(this.getClass()).when(jumar).unmarshal(logT, Mockito.mock(InputStream.class)); + bdfObj.objectify(env, Mockito.mock(InputStream.class)); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - - @Test + + @Test public void testObjectifyIsException() { - JAXBObjectifier bdfObj = null; - try { - bdfObj = new JAXBObjectifier(jumar); - InputStream sr = Mockito.mock(InputStream.class); - Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).unmarshal(logT, sr); - bdfObj.objectify(env, sr); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - + JAXBObjectifier bdfObj = null; + try { + bdfObj = new JAXBObjectifier(jumar); + InputStream sr = Mockito.mock(InputStream.class); + Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).unmarshal(logT, sr); + bdfObj.objectify(env, sr); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - - @Test + + @Test public void testEmptyMethods() { - JAXBObjectifier bdfObj = null; - try { - bdfObj = new JAXBObjectifier(jumar); - bdfObj.servicePrestart(env); - bdfObj.threadPrestart(env); - bdfObj.threadDestroy(env); - bdfObj.serviceDestroy(env); - bdfObj.refresh(env); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } - + JAXBObjectifier bdfObj = null; + try { + bdfObj = new JAXBObjectifier(jumar); + bdfObj.servicePrestart(env); + bdfObj.threadPrestart(env); + bdfObj.threadDestroy(env); + bdfObj.serviceDestroy(env); + bdfObj.refresh(env); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } + } - - @Test + + @Test public void testNewInstance() { - JAXBObjectifier bdfObj = null; - try { - bdfObj = new JAXBObjectifier(jumar); - Object retVal = bdfObj.newInstance(); - Mockito.doThrow(new IllegalAccessException("Test Exception")).when(jumar).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(); - } + JAXBObjectifier bdfObj = null; + try { + bdfObj = new JAXBObjectifier(jumar); + Object retVal = bdfObj.newInstance(); + Mockito.doThrow(new IllegalAccessException("Test Exception")).when(jumar).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 + + @Test public void testNewInstanceException() { - JAXBObjectifier bdfObj = null; - try { - bdfObj = new JAXBObjectifier(jumar); - Mockito.doThrow(new IllegalAccessException("Test Exception")).when(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(); - } - + JAXBObjectifier bdfObj = null; + try { + bdfObj = new JAXBObjectifier(jumar); + Mockito.doThrow(new IllegalAccessException("Test Exception")).when(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(); + } + } } diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java index 7d310ae7..84415fdb 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java @@ -42,145 +42,145 @@ import org.onap.aaf.misc.env.TimeTaken; public class JU_JAXBStringifierTest { - @Mock - JAXBmar jumar; - - @Mock - QName qname; - - @Mock - Env env; - - TimeTaken tt,ttstringify; - - LogTarget logT; - - @Before - public void setUp() { - initMocks(this); - tt=Mockito.mock(TimeTaken.class); - Mockito.doReturn(tt).when(env).start("JAXB Marshal", Env.XML); - Mockito.doNothing().when(tt).done(); - logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - } + @Mock + JAXBmar jumar; + + @Mock + QName qname; + + @Mock + Env env; + + TimeTaken tt,ttstringify; + + LogTarget logT; + + @Before + public void setUp() { + initMocks(this); + tt=Mockito.mock(TimeTaken.class); + Mockito.doReturn(tt).when(env).start("JAXB Marshal", Env.XML); + Mockito.doNothing().when(tt).done(); + logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + } - @Test + @Test public void teststringify() { - JAXBStringifier bdfObj = null; - try { - bdfObj = new JAXBStringifier( qname, new Class[] {this.getClass()}); - bdfObj = new JAXBStringifier(jumar); - Mockito.doReturn(this.getClass()).when(jumar).marshal(logT, jumar, Mockito.mock(StringWriter.class), true); - bdfObj.stringify(env, jumar, true); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - + JAXBStringifier bdfObj = null; + try { + bdfObj = new JAXBStringifier( qname, new Class[] {this.getClass()}); + bdfObj = new JAXBStringifier(jumar); + Mockito.doReturn(this.getClass()).when(jumar).marshal(logT, jumar, Mockito.mock(StringWriter.class), true); + bdfObj.stringify(env, jumar, true); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - - @Test + + @Test public void teststringifyWriter() { - JAXBStringifier bdfObj = null; - try { - bdfObj = new JAXBStringifier(new Class[] {this.getClass()}); - bdfObj = new JAXBStringifier(jumar); - Mockito.doReturn(this.getClass()).when(jumar).marshal(logT, jumar, Mockito.mock(StringWriter.class), true); - bdfObj.stringify(env, jumar, Mockito.mock(StringWriter.class), true); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - + JAXBStringifier bdfObj = null; + try { + bdfObj = new JAXBStringifier(new Class[] {this.getClass()}); + bdfObj = new JAXBStringifier(jumar); + Mockito.doReturn(this.getClass()).when(jumar).marshal(logT, jumar, Mockito.mock(StringWriter.class), true); + bdfObj.stringify(env, jumar, Mockito.mock(StringWriter.class), true); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - - @Test + + @Test public void teststringifyWriterException() { - JAXBStringifier bdfObj = null; - try { - bdfObj = new JAXBStringifier(jumar); - StringWriter sr = Mockito.mock(StringWriter.class); - Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).marshal(logT, jumar, sr, true); - bdfObj.stringify(env, jumar, sr, true); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - + JAXBStringifier bdfObj = null; + try { + bdfObj = new JAXBStringifier(jumar); + StringWriter sr = Mockito.mock(StringWriter.class); + Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).marshal(logT, jumar, sr, true); + bdfObj.stringify(env, jumar, sr, true); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - - @Test + + @Test public void teststringifyOs() { - JAXBStringifier bdfObj = null; - try { - bdfObj = new JAXBStringifier(jumar); - Mockito.doReturn(this.getClass()).when(jumar).marshal(logT, jumar, Mockito.mock(OutputStream.class), true); - bdfObj.stringify(env, jumar, Mockito.mock(OutputStream.class), true); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - + JAXBStringifier bdfObj = null; + try { + bdfObj = new JAXBStringifier(jumar); + Mockito.doReturn(this.getClass()).when(jumar).marshal(logT, jumar, Mockito.mock(OutputStream.class), true); + bdfObj.stringify(env, jumar, Mockito.mock(OutputStream.class), true); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - - @Test + + @Test public void teststringifyOsException() { - JAXBStringifier bdfObj = null; - try { - bdfObj = new JAXBStringifier(jumar); - OutputStream os = Mockito.mock(OutputStream.class); - Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).marshal(logT, jumar, os, true); - bdfObj.stringify(env, jumar, os, true); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - + JAXBStringifier bdfObj = null; + try { + bdfObj = new JAXBStringifier(jumar); + OutputStream os = Mockito.mock(OutputStream.class); + Mockito.doThrow(new JAXBException("Test Exception")).when(jumar).marshal(logT, jumar, os, true); + bdfObj.stringify(env, jumar, os, true); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } catch (JAXBException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } - - @Test + + @Test public void testEmptyMethods() { - JAXBStringifier bdfObj = null; - try { - bdfObj = new JAXBStringifier(jumar); - bdfObj.servicePrestart(env); - bdfObj.threadPrestart(env); - bdfObj.threadDestroy(env); - bdfObj.serviceDestroy(env); - bdfObj.refresh(env); - } catch (APIException e) { - assertTrue(e.getMessage().contains("Test Exception")); - } - + JAXBStringifier bdfObj = null; + try { + bdfObj = new JAXBStringifier(jumar); + bdfObj.servicePrestart(env); + bdfObj.threadPrestart(env); + bdfObj.threadDestroy(env); + bdfObj.serviceDestroy(env); + bdfObj.refresh(env); + } catch (APIException e) { + assertTrue(e.getMessage().contains("Test Exception")); + } + } - - @Test + + @Test public void testPretty() { - JAXBStringifier bdfObj = null; - bdfObj = new JAXBStringifier(jumar); - Mockito.doReturn(jumar).when(jumar).pretty(true); - Object retVal = bdfObj.pretty(true); - assertTrue(retVal instanceof JAXBStringifier); + JAXBStringifier bdfObj = null; + bdfObj = new JAXBStringifier(jumar); + Mockito.doReturn(jumar).when(jumar).pretty(true); + Object retVal = bdfObj.pretty(true); + assertTrue(retVal instanceof JAXBStringifier); } - - @Test + + @Test public void testNewInstanceException() { - JAXBStringifier bdfObj = null; - bdfObj = new JAXBStringifier(jumar); - Mockito.doReturn(jumar).when(jumar).asFragment(true); - Object retVal = bdfObj.asFragment(true); - assertTrue(retVal instanceof JAXBStringifier); - + JAXBStringifier bdfObj = null; + bdfObj = new JAXBStringifier(jumar); + Mockito.doReturn(jumar).when(jumar).asFragment(true); + Object retVal = bdfObj.asFragment(true); + assertTrue(retVal instanceof JAXBStringifier); + } } diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java index 39d43066..22c209c2 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java @@ -45,104 +45,104 @@ import org.onap.aaf.misc.env.TimeTaken; @RunWith(MockitoJUnitRunner.class) public class JU_StoreImplTest { - - @Mock - QName qname; - - @Mock - Env env; - - TimeTaken tt,ttstringify; - - LogTarget logT; - - @Before - public void setUp() { - initMocks(this); - tt=Mockito.mock(TimeTaken.class); - Mockito.doReturn(tt).when(env).start("JAXB Marshal", Env.XML); - Mockito.doNothing().when(tt).done(); - logT = Mockito.mock(LogTarget.class); - Mockito.doReturn(logT).when(env).debug(); - } + + @Mock + QName qname; + + @Mock + Env env; + + TimeTaken tt,ttstringify; + + LogTarget logT; + + @Before + public void setUp() { + initMocks(this); + tt=Mockito.mock(TimeTaken.class); + Mockito.doReturn(tt).when(env).start("JAXB Marshal", Env.XML); + Mockito.doNothing().when(tt).done(); + logT = Mockito.mock(LogTarget.class); + Mockito.doReturn(logT).when(env).debug(); + } - @Test + @Test public void testPropsFromArgs() { - StoreImpl bdfObj = new StoreImpl(); - bdfObj = new StoreImpl(""); - bdfObj.propsFromArgs(null, new String[] {"test"}); - bdfObj.propsFromArgs("test", new String[] {"test","te=st","test=1"}); - + StoreImpl bdfObj = new StoreImpl(); + bdfObj = new StoreImpl(""); + bdfObj.propsFromArgs(null, new String[] {"test"}); + bdfObj.propsFromArgs("test", new String[] {"test","te=st","test=1"}); + } - - @Test + + @Test public void testMorePropsConstructor() { - Properties props = Mockito.mock(Properties.class); - new StoreImpl(null,props); - StoreImpl bdfObj = new StoreImpl("test",props); + Properties props = Mockito.mock(Properties.class); + new StoreImpl(null,props); + StoreImpl bdfObj = new StoreImpl("test",props); } - - @Test + + @Test public void testMorePropsFileNOtExists() { - Properties props = Mockito.mock(Properties.class); - Mockito.doReturn("test").when(props).getProperty("test"); - StoreImpl bdfObj = new StoreImpl("test",props); + Properties props = Mockito.mock(Properties.class); + Mockito.doReturn("test").when(props).getProperty("test"); + StoreImpl bdfObj = new StoreImpl("test",props); } - - @Test + + @Test public void testMorePropsExists() { - Properties props = Mockito.mock(Properties.class); - Mockito.doReturn(System.getProperty("user.dir")+"/src/test/java/org/onap/aaf/misc/env/JU_StoreImplTest.java").when(props).getProperty("test"); - StoreImpl bdfObj = new StoreImpl("test",props); + Properties props = Mockito.mock(Properties.class); + Mockito.doReturn(System.getProperty("user.dir")+"/src/test/java/org/onap/aaf/misc/env/JU_StoreImplTest.java").when(props).getProperty("test"); + StoreImpl bdfObj = new StoreImpl("test",props); } - - @Test + + @Test public void testNewTransState() { - StoreImpl bdfObj = new StoreImpl(null, new String[] {}); - bdfObj.newTransState(); - } - - @Test + StoreImpl bdfObj = new StoreImpl(null, new String[] {}); + bdfObj.newTransState(); + } + + @Test public void testSlot() { - StoreImpl bdfObj = new StoreImpl("test", new String[] {}); - Slot slot = bdfObj.slot(null); - assertEquals(slot.toString(),"=0"); - slot = bdfObj.slot("test"); - assertEquals(slot.toString(),"test=1"); - } - - @Test - public void testExistingSlot() { - StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); - Slot retVal = bdfObj.existingSlot("test"); - assertNull(retVal); - } - - @Test - public void testExistingSlotNames() { - StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); - List retVal = bdfObj.existingSlotNames(); - assertTrue(retVal.size()==0); - } - - @Test - public void testGet() { - StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); - Object retVal = bdfObj.get(new StaticSlot(1,"test"),qname); - assertTrue(retVal instanceof QName); - } - - @Test - public void testGetSlot() { - StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); - Object retVal = bdfObj.get(new StaticSlot(1,"test")); - assertNull(retVal); - } - - @Test - public void testExistingStaticSlotNames() { - StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); - List retVal = bdfObj.existingStaticSlotNames(); - assertTrue(retVal.size()==1); - } + StoreImpl bdfObj = new StoreImpl("test", new String[] {}); + Slot slot = bdfObj.slot(null); + assertEquals(slot.toString(),"=0"); + slot = bdfObj.slot("test"); + assertEquals(slot.toString(),"test=1"); + } + + @Test + public void testExistingSlot() { + StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); + Slot retVal = bdfObj.existingSlot("test"); + assertNull(retVal); + } + + @Test + public void testExistingSlotNames() { + StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); + List retVal = bdfObj.existingSlotNames(); + assertTrue(retVal.size()==0); + } + + @Test + public void testGet() { + StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); + Object retVal = bdfObj.get(new StaticSlot(1,"test"),qname); + assertTrue(retVal instanceof QName); + } + + @Test + public void testGetSlot() { + StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); + Object retVal = bdfObj.get(new StaticSlot(1,"test")); + assertNull(retVal); + } + + @Test + public void testExistingStaticSlotNames() { + StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); + List retVal = bdfObj.existingStaticSlotNames(); + assertTrue(retVal.size()==1); + } } -- cgit 1.2.3-korg