### Question:
JAXBUtils { public static void setEscapeHandler(Marshaller marshaller, Object escapeHandler) { try { String postFix = getPostfix(marshaller.getClass()); if (postFix != null && escapeHandler != null) { marshaller.setProperty("com.sun.xml" + postFix + ".bind.characterEscapeHandler", escapeHandler); } } catch (PropertyException e) { LOG.log(Level.INFO, "Failed to set MinumEscapeHandler to jaxb marshaller", e); } } private  JAXBUtils(); static void closeUnmarshaller(Unmarshaller u); static Object unmarshall(JAXBContext c, Element e); static JAXBElement<T> unmarshall(JAXBContext c, Element e, Class<T> cls); static Object unmarshall(JAXBContext c, Source s); static JAXBElement<T> unmarshall(JAXBContext c,
                                                XMLStreamReader reader,
                                                Class<T> cls); static Object unmarshall(JAXBContext c,
                                    XMLStreamReader reader); static String builtInTypeToJavaType(String type); static Class<?> holderClass(String type); static String namespaceURIToPackage(String namespaceURI); static String nameSpaceURIToPackage(URI uri); static String nameToIdentifier(String name, IdentifierType type); static Class<?> getValidClass(Class<?> cls); static Object setNamespaceMapper(final Map<String, String> nspref,
                                           Marshaller marshaller); static BridgeWrapper createBridge(Set<Class<?>> ctxClasses,
                                      QName qname,
                                      Class<?> refcls,
                                      Annotation[] anns); static SchemaCompiler createSchemaCompiler(); static SchemaCompiler createSchemaCompilerWithDefaultAllocator(Set<String> allocatorSet); static void logGeneratedClassNames(Logger logger, JCodeModel codeModel); static List<String> getGeneratedClassNames(JCodeModel codeModel); static Object createFileCodeWriter(File f); static Object createFileCodeWriter(File f, String encoding); static Class<?> getParamClass(SchemaCompiler sc, String method); static List<DOMResult> generateJaxbSchemas(
        JAXBContext context, final Map<String, DOMResult> builtIns); static String getPackageNamespace(Class<?> cls); static void scanPackages(Set<Class<?>> classes,
                                    Map<Package, CachedClass> objectFactoryCache); static void scanPackages(Set<Class<?>> classes,
                                    Class<?>[] extraClass,
                                    Map<Package, CachedClass> objectFactoryCache); static boolean isJAXB22(); static JAXBContextProxy createJAXBContextProxy(final JAXBContext ctx); static JAXBContextProxy createJAXBContextProxy(final JAXBContext ctx,
                                                          final SchemaCollection collection,
                                                          final String defaultNs); static JAXBBeanInfo getBeanInfo(JAXBContextProxy context, Class<?> cls); static void setMinimumEscapeHandler(Marshaller marshaller); static void setNoEscapeHandler(final Marshaller marshaller); static void setEscapeHandler(Marshaller marshaller, Object escapeHandler); static Object createMininumEscapeHandler(Class<?> cls); static Object createNoEscapeHandler(Class<?> cls); static final String JAXB_URI; }### Answer:
@Test public void testCanSetEscapeHandlerWithStandardJaxbImpl() throws Exception { Marshaller m = new MarshallerImpl((JAXBContextImpl) JAXBContext.newInstance(this.getClass()), null); final Object mockHandler = MinimumEscapeHandler.theInstance; JAXBUtils.setEscapeHandler(m, mockHandler); assertEquals(mockHandler, m.getProperty("com.sun.xml.bind.characterEscapeHandler")); }
@Test public void testCanSetEscapeHandlerWithIbmJaxbImpl() throws Exception { Marshaller m = new MockMarshaller(); final Object mockHandler = new Object(); JAXBUtils.setEscapeHandler(m, mockHandler); assertEquals(mockHandler, m.getProperty("com.sun.xml.bind.characterEscapeHandler")); }