diff options
author | Instrumental <jonathan.gathman@att.com> | 2019-08-07 13:40:39 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2019-08-07 13:40:42 -0500 |
commit | 3d1706fcbe7f95830ff6fd23cf679ee55c6d0595 (patch) | |
tree | ff97f10380a44d9f81d536c066782af10f728687 /misc/env | |
parent | 321dce367d74092a0ba09930c3aa526abdbd5da8 (diff) |
Remove Tabs, per Jococo
Issue-ID: AAF-932
Change-Id: I3ab0ebcc082048d2d1424a58a90ea479fb005ee6
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'misc/env')
14 files changed, 1404 insertions, 1404 deletions
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<ENV extends Env> 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<ENV extends Env> 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<flags.length;++i) {
if ((tt.flag & flags[i]) == flags[i]) {
- metric.buckets[i]+=ms;
+ metric.buckets[i]+=ms;
}
}
}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java index 0c21bda3..15049dcd 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java @@ -30,53 +30,53 @@ import org.onap.aaf.misc.env.impl.EnvFactory; public class JU_BaseDataFactory { - @Before - public void setUp() throws Exception { - initMocks(this); - } - - @Test - public void testGenSchemaException() { - Store env = Mockito.mock(Store.class); - Mockito.doReturn("testdir").when(env).get(null, EnvFactory.DEFAULT_SCHEMA_DIR); - try { - BaseDataFactory.genSchema(env, new String[] {}); - } catch (APIException e) { - assertTrue(e.getLocalizedMessage().contains("does not exist. You can set this with")); - } - } - - @Test - public void testGenSchemaXsdException() { - Store env = Mockito.mock(Store.class); - Mockito.doReturn(System.getProperty("user.dir")).when(env).get(null, EnvFactory.DEFAULT_SCHEMA_DIR); - String[] schemaFIles = new String[] {"../auth-client/src/main/xsd/aaf_2_0.xsd"}; - try { - BaseDataFactory.genSchema(env, schemaFIles); - } catch (APIException e) { - assertTrue(e.getLocalizedMessage().contains("for schema validation")); - } - } - - @Test - public void testGenSchemaNoException() { - Store env = Mockito.mock(Store.class); - Mockito.doReturn(System.getProperty("user.dir")).when(env).get(null, EnvFactory.DEFAULT_SCHEMA_DIR); - String[] schemaFIles = new String[] {"../../auth-client/src/main/xsd/aaf_2_0.xsd"}; - try { - BaseDataFactory.genSchema(env, schemaFIles); - } catch (APIException e) { - e.printStackTrace(); - } - } - - @Test - public void testGetQName() { - String[] schemaFIles = new String[] {"../../auth-client/src/main/xsd/aaf_2_0.xsd"}; - try { - BaseDataFactory.getQName(Api.class); - } catch (APIException e) { - assertTrue(e.getLocalizedMessage().contains("package-info does not have an XmlSchema annotation")); - } - } + @Before + public void setUp() throws Exception { + initMocks(this); + } + + @Test + public void testGenSchemaException() { + Store env = Mockito.mock(Store.class); + Mockito.doReturn("testdir").when(env).get(null, EnvFactory.DEFAULT_SCHEMA_DIR); + try { + BaseDataFactory.genSchema(env, new String[] {}); + } catch (APIException e) { + assertTrue(e.getLocalizedMessage().contains("does not exist. You can set this with")); + } + } + + @Test + public void testGenSchemaXsdException() { + Store env = Mockito.mock(Store.class); + Mockito.doReturn(System.getProperty("user.dir")).when(env).get(null, EnvFactory.DEFAULT_SCHEMA_DIR); + String[] schemaFIles = new String[] {"../auth-client/src/main/xsd/aaf_2_0.xsd"}; + try { + BaseDataFactory.genSchema(env, schemaFIles); + } catch (APIException e) { + assertTrue(e.getLocalizedMessage().contains("for schema validation")); + } + } + + @Test + public void testGenSchemaNoException() { + Store env = Mockito.mock(Store.class); + Mockito.doReturn(System.getProperty("user.dir")).when(env).get(null, EnvFactory.DEFAULT_SCHEMA_DIR); + String[] schemaFIles = new String[] {"../../auth-client/src/main/xsd/aaf_2_0.xsd"}; + try { + BaseDataFactory.genSchema(env, schemaFIles); + } catch (APIException e) { + e.printStackTrace(); + } + } + + @Test + public void testGetQName() { + String[] schemaFIles = new String[] {"../../auth-client/src/main/xsd/aaf_2_0.xsd"}; + try { + BaseDataFactory.getQName(Api.class); + } catch (APIException e) { + assertTrue(e.getLocalizedMessage().contains("package-info does not have an XmlSchema annotation")); + } + } } diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java index d76d8828..a3063f73 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java @@ -43,44 +43,44 @@ public class JU_JavaUtilLogTarget { @Before public void setup() { - initMocks(this); + initMocks(this); } @Test public void testLoggable() { - JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level); - boolean retVal = logObj.isLoggable(); - + JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level); + boolean retVal = logObj.isLoggable(); + assertFalse(retVal); } @Test public void testLog() { - JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level); - Mockito.doReturn(false).when(log).isLoggable(level); - logObj.log(new Object[] {"test","test2",""}); - Mockito.doReturn(true).when(log).isLoggable(level); - logObj.log(new Object[] {"test","test2",""}); - + JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level); + Mockito.doReturn(false).when(log).isLoggable(level); + logObj.log(new Object[] {"test","test2",""}); + Mockito.doReturn(true).when(log).isLoggable(level); + logObj.log(new Object[] {"test","test2",""}); + } @Test public void testLogThrowable() { - JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level); - - Mockito.doReturn(true).when(log).isLoggable(level); - logObj.log(new Throwable("test exception"), new Object[] {"test","test2",""}); - logObj.log(new Throwable(), new Object[] {"test","test2",""}); + JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level); + + Mockito.doReturn(true).when(log).isLoggable(level); + logObj.log(new Throwable("test exception"), new Object[] {"test","test2",""}); + logObj.log(new Throwable(), new Object[] {"test","test2",""}); } @Test public void testPrintf() { - JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level); - - Mockito.doReturn(true).when(log).isLoggable(level); - logObj.printf("test", new Object[] {"test","test2",""}); + JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level); + + Mockito.doReturn(true).when(log).isLoggable(level); + logObj.printf("test", new Object[] {"test","test2",""}); - Mockito.doReturn(false).when(log).isLoggable(level); - logObj.printf("test", new Object[] {"test","test2",""}); + Mockito.doReturn(false).when(log).isLoggable(level); + logObj.printf("test", new Object[] {"test","test2",""}); } } diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_LogTargetTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_LogTargetTest.java index 2388964f..c679d11e 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_LogTargetTest.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_LogTargetTest.java @@ -65,9 +65,9 @@ public class JU_LogTargetTest { outTarget.log(t);
outTarget.log(t, "First String Object");
- assertTrue(outTarget.isLoggable());
+ assertTrue(outTarget.isLoggable());
- verify(t, times(2)).printStackTrace(System.out);
+ verify(t, times(2)).printStackTrace(System.out);
}
@Test
@@ -80,9 +80,9 @@ public class JU_LogTargetTest { errTarget.log(t);
errTarget.log(t, "First String Object");
- assertTrue(errTarget.isLoggable());
+ assertTrue(errTarget.isLoggable());
- verify(t, times(2)).printStackTrace(System.err);
+ verify(t, times(2)).printStackTrace(System.err);
}
}
diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java index d8e843b4..ed75f4cb 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java @@ -28,16 +28,16 @@ public class JU_NullLifeCycle { @Test public void testServicePrestart() { - NullLifeCycle lifeCycleObj = new NullLifeCycle(); - try { - lifeCycleObj.servicePrestart(null); - lifeCycleObj.serviceDestroy(null); - lifeCycleObj.threadDestroy(null); - lifeCycleObj.threadPrestart(null); - lifeCycleObj.refresh(null); - }catch(APIException a) { - - } + NullLifeCycle lifeCycleObj = new NullLifeCycle(); + try { + lifeCycleObj.servicePrestart(null); + lifeCycleObj.serviceDestroy(null); + lifeCycleObj.threadDestroy(null); + lifeCycleObj.threadPrestart(null); + lifeCycleObj.refresh(null); + }catch(APIException a) { + + } } }
\ No newline at end of file diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTrans.java b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTrans.java index 93821606..e1e7d0e9 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTrans.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTrans.java @@ -39,253 +39,253 @@ import org.onap.aaf.misc.env.TimeTaken; public class JU_AbsTrans { - @Mock - Env delegate; - - @Mock - BasicEnv delegate1; - - @Mock - LogTarget lt; - - @Before - public void setUp() { - initMocks(this); - } - - class AbsTransImpl extends AbsTrans{ + @Mock + Env delegate; + + @Mock + BasicEnv delegate1; + + @Mock + LogTarget lt; + + @Before + public void setUp() { + initMocks(this); + } + + class AbsTransImpl extends AbsTrans{ - public AbsTransImpl(Env delegate) { - super(delegate); - // TODO Auto-generated constructor stub - } - - public AbsTransImpl(BasicEnv delegate) { - super(delegate); - // TODO Auto-generated constructor stub - } + public AbsTransImpl(Env delegate) { + super(delegate); + // TODO Auto-generated constructor stub + } + + public AbsTransImpl(BasicEnv delegate) { + super(delegate); + // TODO Auto-generated constructor stub + } - @Override - public Slot slot(String name) { - // TODO Auto-generated method stub - return new Slot(-1, "test"); - } + @Override + public Slot slot(String name) { + // TODO Auto-generated method stub + return new Slot(-1, "test"); + } - @Override - public <T> T get(StaticSlot slot, T dflt) { - // TODO Auto-generated method stub - return null; - } + @Override + public <T> 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> 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<Object> 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<Object> 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<Object> 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<Object> 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> 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<Object> 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<Object> 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<Object> 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<Object> 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<JAXBumar> 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<JAXBumar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar>( 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<JAXBmar> 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<JAXBmar>( 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBmar> 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<JAXBumar> bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF<JAXBumar>( 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<JAXBumar> bdfObj = null; - try { - EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); - bdfObj = new JAXBDF<JAXBumar>( envJaxb, new Class[] {this.getClass()}); - - Object obj = bdfObj.getTypeClass(); - assertFalse(obj instanceof JU_JAXBDF); - } catch (APIException e) { - assertTrue(e.getMessage().contains("test")); - } - + JAXBDF<JAXBumar> bdfObj = null; + try { + EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); + bdfObj = new JAXBDF<JAXBumar>( 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<JAXBmar> bdfObj = null; - try { - bdfObj = new JAXBStringifier<JAXBmar>( qname, new Class[] {this.getClass()}); - bdfObj = new JAXBStringifier<JAXBmar>(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<JAXBmar> bdfObj = null; + try { + bdfObj = new JAXBStringifier<JAXBmar>( qname, new Class[] {this.getClass()}); + bdfObj = new JAXBStringifier<JAXBmar>(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<JAXBmar> bdfObj = null; - try { - bdfObj = new JAXBStringifier<JAXBmar>(new Class[] {this.getClass()}); - bdfObj = new JAXBStringifier<JAXBmar>(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<JAXBmar> bdfObj = null; + try { + bdfObj = new JAXBStringifier<JAXBmar>(new Class[] {this.getClass()}); + bdfObj = new JAXBStringifier<JAXBmar>(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<JAXBmar> bdfObj = null; - try { - bdfObj = new JAXBStringifier<JAXBmar>(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<JAXBmar> bdfObj = null; + try { + bdfObj = new JAXBStringifier<JAXBmar>(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<JAXBmar> bdfObj = null; - try { - bdfObj = new JAXBStringifier<JAXBmar>(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<JAXBmar> bdfObj = null; + try { + bdfObj = new JAXBStringifier<JAXBmar>(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<JAXBmar> bdfObj = null; - try { - bdfObj = new JAXBStringifier<JAXBmar>(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<JAXBmar> bdfObj = null; + try { + bdfObj = new JAXBStringifier<JAXBmar>(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<JAXBmar> bdfObj = null; - try { - bdfObj = new JAXBStringifier<JAXBmar>(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<JAXBmar> bdfObj = null; + try { + bdfObj = new JAXBStringifier<JAXBmar>(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<JAXBmar> bdfObj = null; - bdfObj = new JAXBStringifier<JAXBmar>(jumar); - Mockito.doReturn(jumar).when(jumar).pretty(true); - Object retVal = bdfObj.pretty(true); - assertTrue(retVal instanceof JAXBStringifier); + JAXBStringifier<JAXBmar> bdfObj = null; + bdfObj = new JAXBStringifier<JAXBmar>(jumar); + Mockito.doReturn(jumar).when(jumar).pretty(true); + Object retVal = bdfObj.pretty(true); + assertTrue(retVal instanceof JAXBStringifier); } - - @Test + + @Test public void testNewInstanceException() { - JAXBStringifier<JAXBmar> bdfObj = null; - bdfObj = new JAXBStringifier<JAXBmar>(jumar); - Mockito.doReturn(jumar).when(jumar).asFragment(true); - Object retVal = bdfObj.asFragment(true); - assertTrue(retVal instanceof JAXBStringifier); - + JAXBStringifier<JAXBmar> bdfObj = null; + bdfObj = new JAXBStringifier<JAXBmar>(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<String> 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<String> 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<String> 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<String> retVal = bdfObj.existingStaticSlotNames(); + assertTrue(retVal.size()==1); + } } |