InitialContextInfo implements Serializable { public void setProperty(List<Property> contextProperty) { this.contextProperty = contextProperty; } InitialContextInfo(); List<Property> getContextProperty(); void setProperty(List<Property> contextProperty);  }
@Test public void initialContextInfo_Java2XML() { try { List<Property> properties= new ArrayList<Property>(); Property property1 = new Property(Context.INITIAL_CONTEXT_FACTORY,"value1"); properties.add(property1); Property property2 = new Property(Context.PROVIDER_URL,"value2"); properties.add(property2); InitialContextInfo contextInfo = new InitialContextInfo(); contextInfo.setProperty(properties); JAXBContext jc = JAXBContext.newInstance(InitialContextInfo.class); Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(contextInfo, System.out); } catch (JAXBException e) { e.printStackTrace(); fail("No exception should be thrown"); } }