public Marshaller createMarshaller(Class<?> clazz) throws JAXBException {
    Marshaller marshaller = getContext(clazz).createMarshaller();
    setMarshallerProperties(marshaller);
    if (marshallerEventHandler != null) {
      marshaller.setEventHandler(marshallerEventHandler);
    }
    marshaller.setSchema(marshallerSchema);
    return marshaller;
  }
@Test
  void buildsMarshallerWithSchema() throws Exception {
    Schema schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema();
    JAXBContextFactory factory =
        new JAXBContextFactory.Builder().withMarshallerSchema(schema).build();

    Marshaller marshaller = factory.createMarshaller(Object.class);
    assertThat(marshaller.getSchema()).isSameAs(schema);
  }