The JAXBContext class provides the client's entry point to the Jakarta XML Binding API. It provides an abstraction for managing the XML/Java binding information necessary to implement the Jakarta XML Binding binding framework operations: unmarshal, marshal and validate.
protected JAXBContext()
public void generateSchema(SchemaOutputResolver outputResolver) throws IOException
public static JAXBContext newInstance( Class... classesToBeBound ) throws JAXBException
public static JAXBContext newInstance( Class[] classesToBeBound, Map properties ) throws JAXBException
public static JAXBContext newInstance(String contextPath) throws JAXBException
public static JAXBContext newInstance(java.lang.String contextPath) throws JAXBException
public static JAXBContext newInstance(java.lang.String contextPath, java.lang.ClassLoader classLoader) throws JAXBException
protected JAXBContext()
Domain testing of input and output conditions, and external
pre-conditions for class JAXBContext,
constructor protected JAXBContext()
.
Pre-conditions | Assertion | Expected results | Test Case ID |
---|---|---|---|
called from within a constructor of the child class | Default constructor throws no exceptions. | no exceptions | Ctor001 |
public void generateSchema(SchemaOutputResolver outputResolver) throws IOException
Domain testing of input and output conditions, and external
pre-conditions for class JAXBContext,
method public void generateSchema(SchemaOutputResolver outputResolver) throws IOException
.
Assertion | Test Case ID |
---|---|
generateSchema(SchemaOutputResolver) generates schema for jaxb annotated classes | schemagen001 |
Test cases included:
Ctor001,
newInstance005,
newInstance006,
newInstance007,
newInstance007a,
newInstance008,
newInstance009,
newInstance010,
newInstance011,
newInstance012,
schemagen001.
Item | Value |
---|---|
title | General tests of constructors and newInstance methods |
source | JAXBContextTests.java CustomJAXBContext.java ContextFactory.java package_with_jaxb_index/PurchaseOrderType.java package_with_jaxb_index/Address.java package_with_jaxb_index/Items.java package_with_jaxb_index/package-info.java package_without_jaxb_index/PurchaseOrderType.java package_without_jaxb_index/Address.java package_without_jaxb_index/Items.java package_without_jaxb_index/package-info.java colliding_type_names/PurchaseOrderType.java colliding_type_names/Address.java colliding_type_names/Items.java colliding_type_names/package-info.java |
executeClass | javasoft.sqe.tests.api.jakarta.xml.bind.JAXBContext.JAXBContextTests |
keywords | runtime positive |
executeArgs | -TestCaseID ALL |
public static JAXBContext newInstance( Class... classesToBeBound ) throws JAXBException
Domain testing of input and output conditions, and external
pre-conditions for class JAXBContext,
method public static JAXBContext newInstance( Class... classesToBeBound ) throws JAXBException
.
Assertion | Test Case ID |
---|---|
newInstance(Class ...) creates a jaxbContext with no exception if valid classes are passed as a parameter | newInstance007 |
IllegalArgumentException - if the parameter contains null (i.e., newInstance(null);) | newInstance007a |
newInstance(Class..) throws JAXBException when class tree have colliding type names. | newInstance009 |
newInstance(Class...) with empty parameter list creates a new instance of JAXBContext that "knows" about spec-defined classes. | newInstance010 |
public static JAXBContext newInstance( Class[] classesToBeBound, Map properties ) throws JAXBException
Domain testing of input and output conditions, and external
pre-conditions for class JAXBContext,
method public static JAXBContext newInstance( Class[] classesToBeBound, Map properties ) throws JAXBException
.
Assertion | Test Case ID |
---|---|
newInstance(Class,Map) creates a jaxbContext with no exception if valid classes are passed as a parameter | newInstance008 |
public static JAXBContext newInstance(String contextPath) throws JAXBException
Domain testing of input and output conditions, and external
pre-conditions for class JAXBContext,
method public static JAXBContext newInstance(String contextPath) throws JAXBException
.
Assertion | Test Case ID |
---|---|
newInstance(String) creates a jaxbContext with no exception if valid jaxb.index exists in the package, passed as a parameter. Package contains jaxb-annotated classes and a valid jaxb.index file. | newInstance011 |
newInstance(String) throws a JAXBException when package does not contain neither jaxb.index file nor ObjectFactory class. | newInstance012 |
public static JAXBContext newInstance(java.lang.String contextPath) throws JAXBException
Domain testing of input and output conditions, and external
pre-conditions for class JAXBContext,
method public static JAXBContext newInstance(java.lang.String contextPath) throws JAXBException
.
contextPath | Expected results | Test Case ID |
---|---|---|
unexistent | JAXBException | newInstance006 |
Pre-conditions | Assertion | Expected results | Test Case ID |
---|---|---|---|
contextPath contains unexistent package, class loader is the test class loader | Throws JAXBException if unable to locate a value for the context factory property. | JAXBException is thrown | newInstance006 |
public static JAXBContext newInstance(java.lang.String contextPath, java.lang.ClassLoader classLoader) throws JAXBException
Domain testing of input and output conditions, and external
pre-conditions for class JAXBContext,
method public static JAXBContext newInstance(java.lang.String contextPath, java.lang.ClassLoader classLoader) throws JAXBException
.
contextPath | classLoader | Expected results | Test Case ID |
---|---|---|---|
unexistent | test class loader | JAXBException | newInstance005 |
Pre-conditions | Assertion | Expected results | Test Case ID |
---|---|---|---|
contextPath contains unexistent package, class loader is the test class loader | Throws JAXBException if unable to locate a value for the context factory property. | JAXBException is thrown | newInstance005 |