private static String call_getPreview(WidgetInfo widget,
String propertyName,
String exposedName,
boolean isPublic) throws Exception {
UiBinderContext context = widget.getContext();
String initialSource = context.getDocument().get();
// prepare action
IAction action;
{
action = getExposeAction(widget, propertyName);
assertTrue(action.isEnabled());
}
// get preview
String previewSource;
{
assertNull(call_validate(action, exposedName));
previewSource =
(String) ReflectionUtils.invokeMethod2(
action,
"getPreviewSource",
boolean.class,
isPublic);
}
// assert that source is not changed
assertEquals(initialSource, context.getDocument().get());
// OK
return previewSource;
}