code: public static <T> void marshal(final JAXBContext ctx, final T data, final XmlAdapter<?, ?>[] adapters, final XMLStreamWriter writer) {
          if (data == null) {
              return;
          }
          try {
              final Marshaller marshaller = ctx.createMarshaller();
              if (adapters != null) {
                  for (final XmlAdapter<?, ?> adapter : adapters) {
                      marshaller.setAdapter(adapter);
                  }
              }
              marshaller.marshal(data, writer);
          } catch (final JAXBException ex) {
              throw new RuntimeException(ERROR_MARSHALLING_TEST_DATA, ex);
          }
      }
docs: Marshals the given data using a given context. A <code>null</code> data argument returns <code>null</code>.
  
  @param ctx
  Context to use - Cannot be <code>null</code>.
  @param data
  Data to serialize or <code>null</code>.
  @param adapters
  Adapters to associate with the marshaller or <code>null</code> .
  @param writer
  Writer to use.
  
  @param <T>
  Type of the data to write.