Search in sources :

Example 1 with GwtTestDomException

use of com.googlecode.gwt.test.exceptions.GwtTestDomException in project gwt-test-utils by gwt-test-utils.

the class DocumentPatcher method nativeGet.

@PatchMethod
static Document nativeGet() {
    if (DOCUMENT_HOLDER.document == null) {
        try {
            DOCUMENT_HOLDER.document = JsoUtils.newDocument();
            Element e = parseHTMLElement(DOCUMENT_HOLDER.document);
            DOCUMENT_HOLDER.document.appendChild(e);
            JavaScriptObjects.setProperty(DOCUMENT_HOLDER.document, DOCUMENT_ELEMENT, e);
            return DOCUMENT_HOLDER.document;
        } catch (Exception e) {
            if (GwtTestException.class.isInstance(e)) {
                throw (GwtTestException) e;
            } else {
                throw new GwtTestDomException("Unable to create Document", e);
            }
        }
    }
    return DOCUMENT_HOLDER.document;
}
Also used : GwtTestException(com.googlecode.gwt.test.exceptions.GwtTestException) GwtTestDomException(com.googlecode.gwt.test.exceptions.GwtTestDomException) GwtTestException(com.googlecode.gwt.test.exceptions.GwtTestException) GwtTestConfigurationException(com.googlecode.gwt.test.exceptions.GwtTestConfigurationException) GwtTestDomException(com.googlecode.gwt.test.exceptions.GwtTestDomException) PatchMethod(com.googlecode.gwt.test.patchers.PatchMethod)

Aggregations

GwtTestConfigurationException (com.googlecode.gwt.test.exceptions.GwtTestConfigurationException)1 GwtTestDomException (com.googlecode.gwt.test.exceptions.GwtTestDomException)1 GwtTestException (com.googlecode.gwt.test.exceptions.GwtTestException)1 PatchMethod (com.googlecode.gwt.test.patchers.PatchMethod)1