/** * * @param result */ private void assertResult(Result result) { if (result.wasFailed()) { throw new AssertionFailedError(result.getMessage()); } }
/** * Returns a <code>Result</code> which failed. * * @param message * an error message * @return a <code>Result</code> which failed */ public static Result fail(String message) { return new Result(true, message); }
/** * Checks whether a component is visible and/or enabled before usage * * @param component * @param throwException * @return result */ protected Result checkUsability(final Component component, boolean throwException) { Result res = Result.pass(); if (component.isVisibleInHierarchy() == false) { res = Result.fail("The component is currently not visible in the hierarchy and thus you can not be used." + " Component: " + component); } if (component.isEnabledInHierarchy() == false) { res = Result.fail("The component is currently not enabled in the hierarchy and thus you can not be used." + " Component: " + component); } if (throwException && res.wasFailed()) { throw new AssertionFailedError(res.getMessage()); } return res; }
/** * assert component class * * @param <C> * * @param path * path to component * @param expectedComponentClass * expected component class * @return a <code>Result</code> */ public <C extends Component> Result isComponent(String path, Class<C> expectedComponentClass) { Component component = getComponentFromLastRenderedPage(path); if (component == null) { return Result.fail("Component not found: " + path); } return isTrue("component '" + Classes.simpleName(component.getClass()) + "' is not type:" + Classes.simpleName(expectedComponentClass), expectedComponentClass.isAssignableFrom(component.getClass())); }
+ " will not be rendered at all and thus won't be accessible for subsequent AJAX interaction"; result = isTrue(failMessage, component.getOutputMarkupPlaceholderTag()); if (result.wasFailed()) .find(); result = isTrue(failMessage, isAjaxResponse); if (result.wasFailed()) + "which means that it can't have been added to the AJAX response"; result = isTrue(failMessage, !Strings.isEmpty(markupId)); if (result.wasFailed())
/** * Checks whether a component is visible and/or enabled before usage * * @param component * @param throwException * @return result */ protected Result checkUsability(final Component component, boolean throwException) { Result res = Result.pass(); if (component.isVisibleInHierarchy() == false) { res = Result.fail( "The component is currently not visible in the hierarchy and thus you can not be used." + " Component: " + component); } if (component.isEnabledInHierarchy() == false) { res = Result.fail( "The component is currently not enabled in the hierarchy and thus you can not be used." + " Component: " + component); } if (throwException && res.wasFailed()) { throw new AssertionError(res.getMessage()); } return res; }
assertResult(Result.fail("Missing expected feedback message: " + expected));
componentInfo; result = isTrue(failMessage, component.getOutputMarkupPlaceholderTag()); if (result.wasFailed()) .find(); result = isTrue(failMessage, isAjaxResponse); if (result.wasFailed()) componentInfo; result = isTrue(failMessage, !Strings.isEmpty(markupId)); if (result.wasFailed()) result = isTrue(failMessage, isComponentInAjaxResponse); if (!result.wasFailed()) { return result; boolean isEnclosureInAjaxResponse = !isComponentOnAjaxResponse(enclosure).wasFailed(); return isTrue(failMessage, isEnclosureInAjaxResponse);
private void assertResult(Result result) { if (result.wasFailed()) { throw new AssertionFailedError(result.getMessage()); } }
assertResult(Result.fail("Missing expected feedback message: " + expected));
componentInfo; result = isTrue(failMessage, component.getOutputMarkupPlaceholderTag()); if (result.wasFailed()) .find(); result = isTrue(failMessage, isAjaxResponse); if (result.wasFailed()) "which means that it can't have been added to the AJAX response. " + componentInfo; result = isTrue(failMessage, !Strings.isEmpty(markupId)); if (result.wasFailed()) result = isTrue(failMessage, isComponentInAjaxResponse); if (!result.wasFailed()) boolean isEnclosureInAjaxResponse = !isComponentOnAjaxResponse(enclosure).wasFailed(); return isTrue(failMessage, isEnclosureInAjaxResponse);
/** * Returns a <code>Result</code> which failed. * * @param message * an error message * @return a <code>Result</code> which failed */ public static Result fail(String message) { return new Result(true, message); }
private void assertResult(Result result) { if (result.wasFailed()) { throw new AssertionFailedError(result.getMessage()); } } }
/** * assert component visible. * * @param path * path to component * @return a <code>Result</code> */ public Result isVisible(final String path) { final Result result; Component component = getComponentFromLastRenderedPage(path, false); if (component == null) { result = Result.fail("path: '" + path + "' does not exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); } else { result = isTrue("component '" + path + "' is not visible", component.isVisibleInHierarchy()); } return result; }
+ " will not be rendered at all and thus won't be accessible for subsequent AJAX interaction"; result = isTrue(failMessage, component.getOutputMarkupPlaceholderTag()); if (result.wasFailed()) boolean isAjaxResponse = ajaxResponse.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?><ajax-response>"); result = isTrue(failMessage, isAjaxResponse); if (result.wasFailed()) + "which means that it can't have been added to the AJAX response"; result = isTrue(failMessage, !Strings.isEmpty(markupId)); if (result.wasFailed())
/** * Returns a <code>Result</code> which failed. * * @param message * an error message * @return a <code>Result</code> which failed */ static Result fail(String message) { return new Result(true, message); }