X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=misc%2Fenv%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Faaf%2Fmisc%2Fenv%2Fjaxb%2FJU_JAXBObjectifierTest.java;h=9330f18b4f224d4de59ded888880793480a13503;hb=3d1706fcbe7f95830ff6fd23cf679ee55c6d0595;hp=46feebb131bf52bbb2ddb12361ed5c99d57b4da2;hpb=a5b72a805fdf6fc88de674be886e9c170d0241bd;p=aaf%2Fauthz.git 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(); + } + } }