summaryrefslogtreecommitdiffstats
path: root/misc/rosetta/src
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2019-08-07 13:40:39 -0500
committerInstrumental <jonathan.gathman@att.com>2019-08-07 13:40:42 -0500
commit3d1706fcbe7f95830ff6fd23cf679ee55c6d0595 (patch)
treeff97f10380a44d9f81d536c066782af10f728687 /misc/rosetta/src
parent321dce367d74092a0ba09930c3aa526abdbd5da8 (diff)
Remove Tabs, per Jococo
Issue-ID: AAF-932 Change-Id: I3ab0ebcc082048d2d1424a58a90ea479fb005ee6 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'misc/rosetta/src')
-rw-r--r--misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java2
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java36
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java1198
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java108
-rw-r--r--misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java34
5 files changed, 689 insertions, 689 deletions
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java
index bb590e1c..36ebde68 100644
--- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java
+++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java
@@ -60,7 +60,7 @@ public class RosettaData<T> implements Data<T>{
//Added for junits
void setSaved(Saved saved) {
- this.saved = saved;
+ this.saved = saved;
}
// // @Override
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java
index 1eb55916..1a31b0fb 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java
@@ -26,24 +26,24 @@ import org.junit.Test;
public class JU_ParseException {
- @Test
- public void test() {
- ParseException pe = new ParseException();
- }
- @Test
- public void test1() {
- ParseException pe = new ParseException("exception");
- }
- @Test
- public void test2() {
- ParseException pe = new ParseException(new NullPointerException("exception"));
- }
- @Test
- public void test3() {
- ParseException pe = new ParseException("exception",new NullPointerException("exception"));
- }
+ @Test
+ public void test() {
+ ParseException pe = new ParseException();
+ }
+ @Test
+ public void test1() {
+ ParseException pe = new ParseException("exception");
+ }
+ @Test
+ public void test2() {
+ ParseException pe = new ParseException(new NullPointerException("exception"));
+ }
+ @Test
+ public void test3() {
+ ParseException pe = new ParseException("exception",new NullPointerException("exception"));
+ }
-
-
+
+
}
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java
index cbf7e2dc..9ab3b258 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java
@@ -56,608 +56,608 @@ import org.onap.aaf.misc.rosetta.Saved;
public class JU_RosettaData {
- @Mock
- Env env;
-
- @Mock
- RosettaDF df;
-
- @Mock
- JAXBmar bmar;
-
- @Mock
- Saved saved;
-
- @Before
- public void setUp() {
- initMocks(this);
- }
-
- @Test
- public void testLoad() {
- RosettaData rosettaObj = new RosettaData(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- rosettaObj.setSaved(saved);
- StringReader sr= Mockito.mock(StringReader.class);
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- Mockito.doNothing().when(saved).extract(sr,(Writer)null,inxml);
-
- rosettaObj = rosettaObj.load(sr);
- } catch (APIException | IOException | ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testLoadException() {
- RosettaData rosettaObj = new RosettaData(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- rosettaObj = rosettaObj.load(Mockito.mock(StringReader.class));
- } catch (APIException e) {
- assertTrue(e.getMessage().contains("NullPointerException"));
- }
- }
-
- @Test
- public void testLoadIs() {
- RosettaData rosettaObj = new RosettaData(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- rosettaObj.setSaved(saved);
- InputStream sr= Mockito.mock(InputStream.class);
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- Mockito.doNothing().when(saved).extract(new InputStreamReader(sr),(Writer)null,inxml);
-
- rosettaObj = rosettaObj.load(sr);
- } catch (APIException | IOException | ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testLoadIsException() {
- RosettaData rosettaObj = new RosettaData(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- rosettaObj = rosettaObj.load(Mockito.mock(InputStream.class));
- } catch (APIException e) {
- assertTrue(e.getMessage().contains("NullPointerException"));
- }
- }
-
- @Test
- public void testLoadStr() {
- RosettaData rosettaObj = new RosettaData(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- rosettaObj.setSaved(saved);
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
- rosettaObj = rosettaObj.load("test");
- } catch (APIException | IOException | ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- @Test
- public void testLoadStrJson() {
- RosettaData rosettaObj = new RosettaData(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.JSON);
- rosettaObj.setSaved(saved);
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
- rosettaObj = rosettaObj.load("test");
- } catch (APIException | IOException | ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- @Test
- public void testLoadStrException() {
- RosettaData rosettaObj = new RosettaData(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- rosettaObj = rosettaObj.load("test");
- } catch (APIException e) {
- assertTrue(e.getMessage().contains("NullPointerException"));
- }
- }
-
- @Test
- public void testLoadT() {
- RosettaData rosettaObj = new RosettaData(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- rosettaObj.setSaved(saved);
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
- df.jaxMar = Mockito.mock(JAXBmar.class);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
- rosettaObj = rosettaObj.load(bmar);
- df.marshal = null;
- rosettaObj = rosettaObj.load(bmar);
- } catch (APIException | IOException | ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testLoadTMarshalNull() {
- RosettaData rosettaObj = new RosettaData(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- rosettaObj.setSaved(saved);
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
- df.jaxMar = Mockito.mock(JAXBmar.class);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
- df.marshal = Mockito.mock(Marshal.class);;
- rosettaObj = rosettaObj.load(bmar);
- } catch (APIException | IOException | ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testLoadTException() {
- RosettaData rosettaObj = new RosettaData(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- rosettaObj = rosettaObj.load(bmar);
- } catch (APIException e) {
- assertTrue(e.getMessage().contains("NullPointerException"));
- }
- }
-
- @Test
- public void testGetEvents() {
- RosettaData rosettaObj = new RosettaData(env, df);
- Saved saved = rosettaObj.getEvents();
- assertEquals("Rosetta Saved", saved.logName());
- }
-
- @Test
- public void testAsObject() {
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- rosettaObj.setSaved(saved);
- try {
- Out outxml = Mockito.mock(OutXML.class);
- Mockito.doReturn(outxml).when(df).getOut(Data.TYPE.XML);
- Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
- Mockito.doReturn("test").when(outxml).logName();
- df.jaxMar = Mockito.mock(JAXBmar.class);
- df.jaxUmar = Mockito.mock(JAXBumar.class);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",0);
- LogTarget lt = Mockito.mock(LogTarget.class);
- Mockito.doReturn( lt).when(env).debug();
- Mockito.doNothing().when(saved).extract(null,new StringWriter(),saved);
- Mockito.doReturn(bmar).when(df.jaxUmar).unmarshal(lt,"");
-
- bmar = rosettaObj.asObject();
-
- } catch (APIException | IOException | ParseException | JAXBException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testAsObjectException() {
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- rosettaObj.setSaved(saved);
- try {
- Out outxml = Mockito.mock(OutXML.class);
- Mockito.doReturn(outxml).when(df).getOut(Data.TYPE.XML);
- Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
- Mockito.doReturn("test").when(outxml).logName();
- df.jaxMar = Mockito.mock(JAXBmar.class);
- df.jaxUmar = Mockito.mock(JAXBumar.class);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",0);
- LogTarget lt = Mockito.mock(LogTarget.class);
- Mockito.doReturn( lt).when(env).debug();
- Mockito.doThrow(new IOException("test Exception")).when(saved).extract(null,new StringWriter(),saved);
- Mockito.doThrow(new JAXBException("test Exception")).when(df.jaxUmar).unmarshal(lt,"");
-
- bmar = rosettaObj.asObject();
-
- } catch (APIException | IOException | ParseException | JAXBException e) {
- assertTrue(e.getMessage().contains("test Exception"));
- }
- }
+ @Mock
+ Env env;
+
+ @Mock
+ RosettaDF df;
+
+ @Mock
+ JAXBmar bmar;
+
+ @Mock
+ Saved saved;
+
+ @Before
+ public void setUp() {
+ initMocks(this);
+ }
+
+ @Test
+ public void testLoad() {
+ RosettaData rosettaObj = new RosettaData(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ rosettaObj.setSaved(saved);
+ StringReader sr= Mockito.mock(StringReader.class);
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ Mockito.doNothing().when(saved).extract(sr,(Writer)null,inxml);
+
+ rosettaObj = rosettaObj.load(sr);
+ } catch (APIException | IOException | ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testLoadException() {
+ RosettaData rosettaObj = new RosettaData(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ rosettaObj = rosettaObj.load(Mockito.mock(StringReader.class));
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("NullPointerException"));
+ }
+ }
+
+ @Test
+ public void testLoadIs() {
+ RosettaData rosettaObj = new RosettaData(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ rosettaObj.setSaved(saved);
+ InputStream sr= Mockito.mock(InputStream.class);
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ Mockito.doNothing().when(saved).extract(new InputStreamReader(sr),(Writer)null,inxml);
+
+ rosettaObj = rosettaObj.load(sr);
+ } catch (APIException | IOException | ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testLoadIsException() {
+ RosettaData rosettaObj = new RosettaData(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ rosettaObj = rosettaObj.load(Mockito.mock(InputStream.class));
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("NullPointerException"));
+ }
+ }
+
+ @Test
+ public void testLoadStr() {
+ RosettaData rosettaObj = new RosettaData(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ rosettaObj.setSaved(saved);
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
+
+ rosettaObj = rosettaObj.load("test");
+ } catch (APIException | IOException | ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ @Test
+ public void testLoadStrJson() {
+ RosettaData rosettaObj = new RosettaData(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.JSON);
+ rosettaObj.setSaved(saved);
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
+
+ rosettaObj = rosettaObj.load("test");
+ } catch (APIException | IOException | ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ @Test
+ public void testLoadStrException() {
+ RosettaData rosettaObj = new RosettaData(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ rosettaObj = rosettaObj.load("test");
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("NullPointerException"));
+ }
+ }
+
+ @Test
+ public void testLoadT() {
+ RosettaData rosettaObj = new RosettaData(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ rosettaObj.setSaved(saved);
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
+ df.jaxMar = Mockito.mock(JAXBmar.class);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
+
+ rosettaObj = rosettaObj.load(bmar);
+ df.marshal = null;
+ rosettaObj = rosettaObj.load(bmar);
+ } catch (APIException | IOException | ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testLoadTMarshalNull() {
+ RosettaData rosettaObj = new RosettaData(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ rosettaObj.setSaved(saved);
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
+ df.jaxMar = Mockito.mock(JAXBmar.class);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
+ df.marshal = Mockito.mock(Marshal.class);;
+ rosettaObj = rosettaObj.load(bmar);
+ } catch (APIException | IOException | ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testLoadTException() {
+ RosettaData rosettaObj = new RosettaData(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ rosettaObj = rosettaObj.load(bmar);
+ } catch (APIException e) {
+ assertTrue(e.getMessage().contains("NullPointerException"));
+ }
+ }
+
+ @Test
+ public void testGetEvents() {
+ RosettaData rosettaObj = new RosettaData(env, df);
+ Saved saved = rosettaObj.getEvents();
+ assertEquals("Rosetta Saved", saved.logName());
+ }
+
+ @Test
+ public void testAsObject() {
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ rosettaObj.setSaved(saved);
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+ Mockito.doReturn(outxml).when(df).getOut(Data.TYPE.XML);
+ Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
+ Mockito.doReturn("test").when(outxml).logName();
+ df.jaxMar = Mockito.mock(JAXBmar.class);
+ df.jaxUmar = Mockito.mock(JAXBumar.class);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",0);
+ LogTarget lt = Mockito.mock(LogTarget.class);
+ Mockito.doReturn( lt).when(env).debug();
+ Mockito.doNothing().when(saved).extract(null,new StringWriter(),saved);
+ Mockito.doReturn(bmar).when(df.jaxUmar).unmarshal(lt,"");
+
+ bmar = rosettaObj.asObject();
+
+ } catch (APIException | IOException | ParseException | JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testAsObjectException() {
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ rosettaObj.setSaved(saved);
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+ Mockito.doReturn(outxml).when(df).getOut(Data.TYPE.XML);
+ Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
+ Mockito.doReturn("test").when(outxml).logName();
+ df.jaxMar = Mockito.mock(JAXBmar.class);
+ df.jaxUmar = Mockito.mock(JAXBumar.class);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",0);
+ LogTarget lt = Mockito.mock(LogTarget.class);
+ Mockito.doReturn( lt).when(env).debug();
+ Mockito.doThrow(new IOException("test Exception")).when(saved).extract(null,new StringWriter(),saved);
+ Mockito.doThrow(new JAXBException("test Exception")).when(df.jaxUmar).unmarshal(lt,"");
+
+ bmar = rosettaObj.asObject();
+
+ } catch (APIException | IOException | ParseException | JAXBException e) {
+ assertTrue(e.getMessage().contains("test Exception"));
+ }
+ }
- @Test
- public void testAsString() {
- TYPE type = TYPE.XML;
- Mockito.doReturn(type).when(df).getOutType();
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- rosettaObj.setSaved(saved);
- try {
- Out outxml = Mockito.mock(OutXML.class);
-
- Mockito.doReturn(outxml).when(df).getOut(type);
- Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
- Mockito.doReturn("test").when(outxml).logName();
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
-
- String retVal = rosettaObj.asString();
- assertTrue("".equals(retVal));
- } catch (APIException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testAsStringJson() {
- TYPE type = TYPE.JSON;
- Mockito.doReturn(type).when(df).getOutType();
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.JSON);
- rosettaObj.setSaved(saved);
- try {
- Out outxml = Mockito.mock(OutXML.class);
-
- Mockito.doReturn(outxml).when(df).getOut(type);
- Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON);
- Mockito.doReturn("test").when(outxml).logName();
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4);
-
- String retVal = rosettaObj.asString();
- assertTrue("".equals(retVal));
- } catch (APIException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- @Test
- public void testToXml() {
- TYPE type = TYPE.XML;
- Mockito.doReturn(type).when(df).getOutType();
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- rosettaObj.setSaved(saved);
-
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
- rosettaObj = rosettaObj.load("test");
- } catch (APIException | IOException | ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- try {
- Out outxml = Mockito.mock(OutXML.class);
-
- Mockito.doReturn(outxml).when(df).getOut(type);
- Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
- Mockito.doReturn("test").when(outxml).logName();
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
- RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class));
-
- } catch (APIException | IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testToJson() {
- TYPE type = TYPE.JSON;
- Mockito.doReturn(type).when(df).getOutType();
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.JSON);
- rosettaObj.setSaved(saved);
-
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
- rosettaObj = rosettaObj.load("test");
- } catch (APIException | IOException | ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- try {
- Out outxml = Mockito.mock(OutXML.class);
-
- Mockito.doReturn(outxml).when(df).getOut(type);
- Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON);
- Mockito.doReturn("test").when(outxml).logName();
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4);
- RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class));
-
- } catch (APIException | IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testTo() {
- TYPE type = TYPE.XML;
- Mockito.doReturn(type).when(df).getOutType();
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- rosettaObj.setSaved(saved);
-
- try {
- Out outxml = Mockito.mock(OutXML.class);
-
- Mockito.doReturn(outxml).when(df).getOut(type);
- Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
- Mockito.doReturn("test").when(outxml).logName();
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
- RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class));
-
- } catch (APIException | IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testToWriterXml() {
- TYPE type = TYPE.XML;
- Mockito.doReturn(type).when(df).getOutType();
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- rosettaObj.setSaved(saved);
-
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
- rosettaObj = rosettaObj.load("test");
- } catch (APIException | IOException | ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- try {
- Out outxml = Mockito.mock(OutXML.class);
-
- Mockito.doReturn(outxml).when(df).getOut(type);
- Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
- Mockito.doReturn("test").when(outxml).logName();
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
- RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class));
-
- } catch (APIException | IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testToWriterJson() {
- TYPE type = TYPE.JSON;
- Mockito.doReturn(type).when(df).getOutType();
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.JSON);
- rosettaObj.setSaved(saved);
-
- try {
- InXML inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON);
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
- Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
-
- rosettaObj = rosettaObj.load("test");
- } catch (APIException | IOException | ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- try {
- Out outxml = Mockito.mock(OutXML.class);
-
- Mockito.doReturn(outxml).when(df).getOut(type);
- Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON);
- Mockito.doReturn("test").when(outxml).logName();
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4);
- RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class));
-
- } catch (APIException | IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testToWriter() {
- TYPE type = TYPE.XML;
- Mockito.doReturn(type).when(df).getOutType();
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- rosettaObj = rosettaObj.in(Data.TYPE.XML);
- rosettaObj.setSaved(saved);
-
- try {
- Out outxml = Mockito.mock(OutXML.class);
-
- Mockito.doReturn(outxml).when(df).getOut(type);
- Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
- Mockito.doReturn("test").when(outxml).logName();
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
- RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class));
-
- } catch (APIException | IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testGetTypeClass() {
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- rosettaObj.getTypeClass();
- }
-
- @Test
- public void testDirect() {
- TYPE type = TYPE.XML;
- Mockito.doReturn(type).when(df).getOutType();
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- try {
- Out outxml = Mockito.mock(OutXML.class);
- Mockito.doReturn(outxml).when(df).getOut(type);
- Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
- Mockito.doReturn("test").when(outxml).logName();
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
- rosettaObj.direct(Mockito.mock(InputStream.class), Mockito.mock(OutputStream.class));
- } catch (APIException | IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testDirectException() {
- TYPE type = TYPE.XML;
- Mockito.doReturn(type).when(df).getOutType();
- Mockito.doReturn(type).when(df).getInType();
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- InXML inxml = null;
-
- inxml = Mockito.mock(InXML.class);
- Mockito.doReturn(inxml).when(df).getIn(type);
-
-
- StringReader is = Mockito.mock(StringReader.class);
- StringWriter os= Mockito.mock(StringWriter.class);
- try {
- Out outxml = Mockito.mock(OutXML.class);
- Mockito.doReturn(outxml).when(df).getOut(type);
- Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
- Mockito.doReturn("test").when(outxml).logName();
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
- Mockito.doThrow( new IOException("testException")).when(outxml).extract(is, os, inxml, true);
-
- rosettaObj.direct(is,os, true);
- } catch (APIException | IOException | ParseException e) {
- // TODO Auto-generated catch block
- assertTrue(e.getMessage().contains("testException"));
- }
- }
-
- @Test
- public void testDirectT() {
- TYPE type = TYPE.XML;
- Mockito.doReturn(type).when(df).getOutType();
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- try {
- Out outxml = Mockito.mock(OutXML.class);
- Mockito.doReturn(outxml).when(df).getOut(type);
- Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
- Mockito.doReturn("test").when(outxml).logName();
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
+ @Test
+ public void testAsString() {
+ TYPE type = TYPE.XML;
+ Mockito.doReturn(type).when(df).getOutType();
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ rosettaObj.setSaved(saved);
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+
+ Mockito.doReturn(outxml).when(df).getOut(type);
+ Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
+ Mockito.doReturn("test").when(outxml).logName();
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
+
+ String retVal = rosettaObj.asString();
+ assertTrue("".equals(retVal));
+ } catch (APIException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testAsStringJson() {
+ TYPE type = TYPE.JSON;
+ Mockito.doReturn(type).when(df).getOutType();
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.JSON);
+ rosettaObj.setSaved(saved);
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+
+ Mockito.doReturn(outxml).when(df).getOut(type);
+ Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON);
+ Mockito.doReturn("test").when(outxml).logName();
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4);
+
+ String retVal = rosettaObj.asString();
+ assertTrue("".equals(retVal));
+ } catch (APIException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ @Test
+ public void testToXml() {
+ TYPE type = TYPE.XML;
+ Mockito.doReturn(type).when(df).getOutType();
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ rosettaObj.setSaved(saved);
+
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
+
+ rosettaObj = rosettaObj.load("test");
+ } catch (APIException | IOException | ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+
+ Mockito.doReturn(outxml).when(df).getOut(type);
+ Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
+ Mockito.doReturn("test").when(outxml).logName();
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
+ RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class));
+
+ } catch (APIException | IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testToJson() {
+ TYPE type = TYPE.JSON;
+ Mockito.doReturn(type).when(df).getOutType();
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.JSON);
+ rosettaObj.setSaved(saved);
+
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
+
+ rosettaObj = rosettaObj.load("test");
+ } catch (APIException | IOException | ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+
+ Mockito.doReturn(outxml).when(df).getOut(type);
+ Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON);
+ Mockito.doReturn("test").when(outxml).logName();
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4);
+ RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class));
+
+ } catch (APIException | IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testTo() {
+ TYPE type = TYPE.XML;
+ Mockito.doReturn(type).when(df).getOutType();
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ rosettaObj.setSaved(saved);
+
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+
+ Mockito.doReturn(outxml).when(df).getOut(type);
+ Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
+ Mockito.doReturn("test").when(outxml).logName();
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
+ RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class));
+
+ } catch (APIException | IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testToWriterXml() {
+ TYPE type = TYPE.XML;
+ Mockito.doReturn(type).when(df).getOutType();
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ rosettaObj.setSaved(saved);
+
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
+
+ rosettaObj = rosettaObj.load("test");
+ } catch (APIException | IOException | ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+
+ Mockito.doReturn(outxml).when(df).getOut(type);
+ Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
+ Mockito.doReturn("test").when(outxml).logName();
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
+ RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class));
+
+ } catch (APIException | IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testToWriterJson() {
+ TYPE type = TYPE.JSON;
+ Mockito.doReturn(type).when(df).getOutType();
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.JSON);
+ rosettaObj.setSaved(saved);
+
+ try {
+ InXML inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON);
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env);
+ Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml);
+
+ rosettaObj = rosettaObj.load("test");
+ } catch (APIException | IOException | ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+
+ Mockito.doReturn(outxml).when(df).getOut(type);
+ Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON);
+ Mockito.doReturn("test").when(outxml).logName();
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4);
+ RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class));
+
+ } catch (APIException | IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testToWriter() {
+ TYPE type = TYPE.XML;
+ Mockito.doReturn(type).when(df).getOutType();
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ rosettaObj = rosettaObj.in(Data.TYPE.XML);
+ rosettaObj.setSaved(saved);
+
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+
+ Mockito.doReturn(outxml).when(df).getOut(type);
+ Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
+ Mockito.doReturn("test").when(outxml).logName();
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
+ RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class));
+
+ } catch (APIException | IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testGetTypeClass() {
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ rosettaObj.getTypeClass();
+ }
+
+ @Test
+ public void testDirect() {
+ TYPE type = TYPE.XML;
+ Mockito.doReturn(type).when(df).getOutType();
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+ Mockito.doReturn(outxml).when(df).getOut(type);
+ Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
+ Mockito.doReturn("test").when(outxml).logName();
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
+ rosettaObj.direct(Mockito.mock(InputStream.class), Mockito.mock(OutputStream.class));
+ } catch (APIException | IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testDirectException() {
+ TYPE type = TYPE.XML;
+ Mockito.doReturn(type).when(df).getOutType();
+ Mockito.doReturn(type).when(df).getInType();
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ InXML inxml = null;
+
+ inxml = Mockito.mock(InXML.class);
+ Mockito.doReturn(inxml).when(df).getIn(type);
+
+
+ StringReader is = Mockito.mock(StringReader.class);
+ StringWriter os= Mockito.mock(StringWriter.class);
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+ Mockito.doReturn(outxml).when(df).getOut(type);
+ Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
+ Mockito.doReturn("test").when(outxml).logName();
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
+ Mockito.doThrow( new IOException("testException")).when(outxml).extract(is, os, inxml, true);
+
+ rosettaObj.direct(is,os, true);
+ } catch (APIException | IOException | ParseException e) {
+ // TODO Auto-generated catch block
+ assertTrue(e.getMessage().contains("testException"));
+ }
+ }
+
+ @Test
+ public void testDirectT() {
+ TYPE type = TYPE.XML;
+ Mockito.doReturn(type).when(df).getOutType();
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+ Mockito.doReturn(outxml).when(df).getOut(type);
+ Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
+ Mockito.doReturn("test").when(outxml).logName();
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
- df.jaxMar = Mockito.mock(JAXBmar.class);
- LogTarget lt = Mockito.mock(LogTarget.class);
- Mockito.doReturn( lt).when(env).debug();
- Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true);
-
- rosettaObj.direct(bmar, Mockito.mock(StringWriter.class), true);
- df.marshal =Mockito.mock(Marshal.class);;
- rosettaObj.direct(bmar, Mockito.mock(StringWriter.class), true);
- } catch (APIException | IOException | JAXBException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testDirectTOS() {
- TYPE type = TYPE.XML;
- Mockito.doReturn(type).when(df).getOutType();
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- try {
- Out outxml = Mockito.mock(OutXML.class);
- Mockito.doReturn(outxml).when(df).getOut(type);
- Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
- Mockito.doReturn("test").when(outxml).logName();
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
+ df.jaxMar = Mockito.mock(JAXBmar.class);
+ LogTarget lt = Mockito.mock(LogTarget.class);
+ Mockito.doReturn( lt).when(env).debug();
+ Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true);
+
+ rosettaObj.direct(bmar, Mockito.mock(StringWriter.class), true);
+ df.marshal =Mockito.mock(Marshal.class);;
+ rosettaObj.direct(bmar, Mockito.mock(StringWriter.class), true);
+ } catch (APIException | IOException | JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testDirectTOS() {
+ TYPE type = TYPE.XML;
+ Mockito.doReturn(type).when(df).getOutType();
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+ Mockito.doReturn(outxml).when(df).getOut(type);
+ Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML);
+ Mockito.doReturn("test").when(outxml).logName();
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2);
- df.jaxMar = Mockito.mock(JAXBmar.class);
- LogTarget lt = Mockito.mock(LogTarget.class);
- Mockito.doReturn( lt).when(env).debug();
- Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true);
-
- rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true);
- df.marshal =Mockito.mock(Marshal.class);;
- rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true);
- } catch (APIException | IOException | JAXBException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testDirectTOSJson() {
- TYPE type = TYPE.JSON;
- Mockito.doReturn(type).when(df).getOutType();
- RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
- try {
- Out outxml = Mockito.mock(OutXML.class);
- Mockito.doReturn(outxml).when(df).getOut(type);
- Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON);
- Mockito.doReturn("test").when(outxml).logName();
- Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4);
+ df.jaxMar = Mockito.mock(JAXBmar.class);
+ LogTarget lt = Mockito.mock(LogTarget.class);
+ Mockito.doReturn( lt).when(env).debug();
+ Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true);
+
+ rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true);
+ df.marshal =Mockito.mock(Marshal.class);;
+ rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true);
+ } catch (APIException | IOException | JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testDirectTOSJson() {
+ TYPE type = TYPE.JSON;
+ Mockito.doReturn(type).when(df).getOutType();
+ RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df);
+ try {
+ Out outxml = Mockito.mock(OutXML.class);
+ Mockito.doReturn(outxml).when(df).getOut(type);
+ Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON);
+ Mockito.doReturn("test").when(outxml).logName();
+ Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4);
- df.jaxMar = Mockito.mock(JAXBmar.class);
- LogTarget lt = Mockito.mock(LogTarget.class);
- Mockito.doReturn( lt).when(env).debug();
- Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true);
-
- rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true);
- } catch (APIException | IOException | JAXBException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
+ df.jaxMar = Mockito.mock(JAXBmar.class);
+ LogTarget lt = Mockito.mock(LogTarget.class);
+ Mockito.doReturn( lt).when(env).debug();
+ Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true);
+
+ rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true);
+ } catch (APIException | IOException | JAXBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
}
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java
index b5889b45..c8771519 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java
@@ -41,58 +41,58 @@ import org.onap.aaf.misc.rosetta.Saved;
public class JU_RosettaEnv {
- @Before
- public void setUp() {
- initMocks(this);
- }
-
- @Test
- public void testNewDataFactoryClass() {
- RosettaEnv rosettaObj = new RosettaEnv();
- try {
- Object retVal = rosettaObj.newDataFactory(Api.class);
- assertTrue(retVal instanceof RosettaDF);
- } catch (APIException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testNewDataFactorySchema() {
- RosettaEnv rosettaObj = new RosettaEnv(Mockito.mock(Applet.class),"test");
- try {
- Object retVal = rosettaObj.newDataFactory(Mockito.mock(Schema.class),Api.class);
- assertTrue(retVal instanceof RosettaDF);
- } catch (APIException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testNewDataFactoryQname() {
- RosettaEnv rosettaObj = new RosettaEnv(new String[] {"test"});
- rosettaObj = new RosettaEnv(Mockito.mock(Properties.class));
- try {
- Object retVal = rosettaObj.newDataFactory(Mockito.mock(QName.class),Api.class);
- assertTrue(retVal instanceof RosettaDF);
- } catch (APIException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Test
- public void testNewDataFactoryQnameSchema() {
- RosettaEnv rosettaObj = new RosettaEnv("test", new String[] {"test"});
- rosettaObj = new RosettaEnv("test", Mockito.mock(Properties.class));
- try {
- Object retVal = rosettaObj.newDataFactory(Mockito.mock(Schema.class),Mockito.mock(QName.class),Api.class);
- assertTrue(retVal instanceof RosettaDF);
- } catch (APIException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
+ @Before
+ public void setUp() {
+ initMocks(this);
+ }
+
+ @Test
+ public void testNewDataFactoryClass() {
+ RosettaEnv rosettaObj = new RosettaEnv();
+ try {
+ Object retVal = rosettaObj.newDataFactory(Api.class);
+ assertTrue(retVal instanceof RosettaDF);
+ } catch (APIException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testNewDataFactorySchema() {
+ RosettaEnv rosettaObj = new RosettaEnv(Mockito.mock(Applet.class),"test");
+ try {
+ Object retVal = rosettaObj.newDataFactory(Mockito.mock(Schema.class),Api.class);
+ assertTrue(retVal instanceof RosettaDF);
+ } catch (APIException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testNewDataFactoryQname() {
+ RosettaEnv rosettaObj = new RosettaEnv(new String[] {"test"});
+ rosettaObj = new RosettaEnv(Mockito.mock(Properties.class));
+ try {
+ Object retVal = rosettaObj.newDataFactory(Mockito.mock(QName.class),Api.class);
+ assertTrue(retVal instanceof RosettaDF);
+ } catch (APIException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testNewDataFactoryQnameSchema() {
+ RosettaEnv rosettaObj = new RosettaEnv("test", new String[] {"test"});
+ rosettaObj = new RosettaEnv("test", Mockito.mock(Properties.class));
+ try {
+ Object retVal = rosettaObj.newDataFactory(Mockito.mock(Schema.class),Mockito.mock(QName.class),Api.class);
+ assertTrue(retVal instanceof RosettaDF);
+ } catch (APIException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
}
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java
index c28e83d5..5b7875f7 100644
--- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java
+++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java
@@ -26,24 +26,24 @@ import org.onap.aaf.misc.env.jaxb.JAXBumar;
public class JU_FieldBlob {
- class FieldBlobImpl extends FieldBlob{
+ class FieldBlobImpl extends FieldBlob{
- public FieldBlobImpl(String name) {
- super(name);
- // TODO Auto-generated constructor stub
- }
+ public FieldBlobImpl(String name) {
+ super(name);
+ // TODO Auto-generated constructor stub
+ }
- @Override
- protected byte[] data(Object t) {
- // TODO Auto-generated method stub
- return null;
- }
-
- }
- @Test
- public void testData() {
- FieldBlob<JAXBumar> obj = new FieldBlobImpl("test");
- obj.data(Mockito.mock(JAXBumar.class), new StringBuilder());
- }
+ @Override
+ protected byte[] data(Object t) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ }
+ @Test
+ public void testData() {
+ FieldBlob<JAXBumar> obj = new FieldBlobImpl("test");
+ obj.data(Mockito.mock(JAXBumar.class), new StringBuilder());
+ }
}