use of com.googlecode.gwt.test.patchers.PatchMethod in project gwt-test-utils by gwt-test-utils.
the class SafeHtmlUtilsPatcher method fromSafeConstant.
@PatchMethod
public static SafeHtml fromSafeConstant(String s) {
// PatchMethod to avoid gwt-dev dependency.. See SafeHtmlHostedModeUtils
Class<?> clazz;
try {
clazz = Class.forName("com.google.gwt.safehtml.shared.SafeHtmlString");
Constructor<?> cons = clazz.getDeclaredConstructor(String.class);
return (SafeHtml) GwtReflectionUtils.instantiateClass(cons, s);
} catch (Exception e) {
throw new GwtTestPatchException("Error while instanciate a SafeHtmlString instance", e);
}
}
Aggregations