- DynamicEntity eventHeader = Mockito.mock(DynamicEntity.class);
- DynamicEntity obj = Mockito.mock(DynamicEntity.class);
- DynamicJAXBContext notificationJaxbContext = Mockito.mock(DynamicJAXBContext.class);
- ClassLoader cl = getClass().getClassLoader();
- InputStream is = cl.getResourceAsStream("oxm/aai_oxm_v12.xml");
- Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, is);
- DynamicJAXBContext notificationJaxbContextReal = DynamicJAXBContextFactory.createContextFromOXM(cl, properties);
- DynamicType dtReal = notificationJaxbContextReal.getDynamicType("inventory.aai.onap.org.v12.NotificationEvent");
- DynamicType dt = Mockito.mock(DynamicType.class);
- DynamicEntity notificationEventReal = dtReal.newDynamicEntity();
- JAXBMarshaller marshaller = Mockito.mock(JAXBMarshaller.class);
-
- Mockito.when(notificationJaxbContext.getDynamicType(Mockito.anyString())).thenReturn(dt);
- Mockito.when(dt.newDynamicEntity()).thenReturn(notificationEventReal);
- Mockito.when(notificationJaxbContext.createMarshaller()).thenReturn(marshaller);
- Mockito.doNothing().when(marshaller).marshal(Mockito.any(DynamicJAXBContext.class), Mockito.any(StringWriter.class));