/** * Static factory method for creating a <code>TagTester</code> based on a tag found by an * attribute with a specific value. Please note that it will return the first tag which matches * the criteria. It's therefore good for attributes suck as "id" or "wicket:id", but only if * "wicket:id" is unique in the specified markup. * * @param markup * the markup to look for the tag to create the <code>TagTester</code> from * @param attribute * the attribute which should be on the tag in the markup * @param value * the value which the attribute must have * @return the <code>TagTester</code> which matches the tag in the markup, that has the given * value on the given attribute */ @Deprecated public static TagTester createTagsByAttribute(String markup, String attribute, String value) { return createTagByAttribute(markup, attribute, value); }
/** * Retrieves a <code>TagTester</code> based on a <code>wicket:id</code>. If more * <code>Component</code>s exist with the same <code>wicket:id</code> in the markup, only the * first one is returned. * * @param wicketId * the <code>wicket:id</code> to search for * @return the <code>TagTester</code> for the tag which has the given <code>wicket:id</code> */ public TagTester getTagByWicketId(String wicketId) { return TagTester.createTagByAttribute(getLastResponseAsString(), "wicket:id", wicketId); }
/** * Retrieves a <code>TagTester</code> based on a <code>wicket:id</code>. If more * <code>Component</code>s exist with the same <code>wicket:id</code> in the markup, only the * first one is returned. * * @param wicketId * the <code>wicket:id</code> to search for * @return the <code>TagTester</code> for the tag which has the given <code>wicket:id</code> */ public TagTester getTagByWicketId(String wicketId) { return TagTester.createTagByAttribute(getLastResponseAsString(), "wicket:id", wicketId); }
/** * Retrieves a <code>TagTester</code> based on an DOM id. If more <code>Component</code>s exist * with the same id in the markup, only the first one is returned. * * @param id * the DOM id to search for. * @return the <code>TagTester</code> for the tag which has the given DOM id */ public TagTester getTagById(String id) { return TagTester.createTagByAttribute(getLastResponseAsString(), "id", id); }
/** * Retrieves a <code>TagTester</code> based on an DOM id. If more <code>Component</code>s exist * with the same id in the markup, only the first one is returned. * * @param id * the DOM id to search for. * @return the <code>TagTester</code> for the tag which has the given DOM id */ public TagTester getTagById(String id) { return TagTester.createTagByAttribute(getLastResponseAsString(), "id", id); }
/** * Retrieves a <code>TagTester</code> based on an DOM id. If more <code>Component</code>s * exist with the same id in the markup, only the first one is returned. * * @param id * the DOM id to search for. * @return the <code>TagTester</code> for the tag which has the given DOM id */ public TagTester getTagById(String id) { return TagTester.createTagByAttribute(getServletResponse().getDocument(), "id", id); }
/** * Retrieves a <code>TagTester</code> based on an DOM id. If more <code>Component</code>s exist * with the same id in the markup, only the first one is returned. * * @param id * the DOM id to search for. * @return the <code>TagTester</code> for the tag which has the given DOM id */ public TagTester getTagById(String id) { return TagTester.createTagByAttribute(getServletResponse().getDocument(), "id", id); }
/** * Retrieves a <code>TagTester</code> based on a <code>wicket:id</code>. If more * <code>Component</code>s exist with the same <code>wicket:id</code> in the markup, only the * first one is returned. * * @param wicketId * the <code>wicket:id</code> to search for * @return the <code>TagTester</code> for the tag which has the given <code>wicket:id</code> */ public TagTester getTagByWicketId(String wicketId) { return TagTester.createTagByAttribute(getServletResponse().getDocument(), "wicket:id", wicketId); }
/** * Retrieves a <code>TagTester</code> based on a <code>wicket:id</code>. If more * <code>Component</code>s exist with the same <code>wicket:id</code> in the markup, only * the first one is returned. * * @param wicketId * the <code>wicket:id</code> to search for * @return the <code>TagTester</code> for the tag which has the given <code>wicket:id</code> */ public TagTester getTagByWicketId(String wicketId) { return TagTester.createTagByAttribute(getServletResponse().getDocument(), "wicket:id", wicketId); }
@Override protected boolean matchesSafely(Component item, Description mismatchDescription) { final String itemMarkupId = item.getMarkupId(false); checkMarkupIdNotNull(itemMarkupId); checkAttributesListNotEmpty(attributesList); final TagTester tagTester = TagTester.createTagByAttribute(response, "id", itemMarkupId); if (tagTester == null) { mismatchDescription.appendText("Matching tag was not found in the given response"); return false; } Matcher<TagTester> tagTesterMatcher = allOf(attributesList); tagTesterMatcher.describeMismatch(tagTester, mismatchDescription); return tagTesterMatcher.matches(tagTester); }
/** * Gets a child tag for testing. If this tag contains child tags, you can get one of them as a * {@link TagTester} instance. * * @param attribute * an attribute on the child tag to search for * @param value * a value that the attribute must have * @return the <code>TagTester</code> for the child tag */ public TagTester getChild(String attribute, String value) { TagTester childTag = null; if (openTag.isOpen()) { // Generate the markup for this tag String markup = getMarkup(); if (Strings.isEmpty(markup) == false) { childTag = TagTester.createTagByAttribute(markup, attribute, value); } } return childTag; }
/** * Gets a child tag for testing. If this tag contains child tags, you can get one of them as a * {@link TagTester} instance. * * @param attribute * an attribute on the child tag to search for * @param value * a value that the attribute must have * @return the <code>TagTester</code> for the child tag */ public TagTester getChild(String attribute, String value) { TagTester childTag = null; if (openTag.isOpen()) { // Generate the markup for this tag String markup = getMarkup(); if (Strings.isEmpty(markup) == false) { childTag = TagTester.createTagByAttribute(markup, attribute, value); } } return childTag; }
/** * Gets a child tag for testing. If this tag contains child tags, you can get one of them as a * {@link TagTester} instance. * * @param attribute * an attribute on the child tag to search for * @param value * a value that the attribute must have * @return the <code>TagTester</code> for the child tag */ public TagTester getChild(String attribute, String value) { TagTester childTag = null; if (openTag.isOpen()) { // Generate the markup for this tag String markup = getMarkup(); if (Strings.isEmpty(markup) == false) { childTag = TagTester.createTagByAttribute(markup, attribute, value); } } return childTag; }
/** * Gets a child tag for testing. If this tag contains child tags, you can get one of them as a * {@link TagTester} instance. * * @param attribute * an attribute on the child tag to search for * @param value * a value that the attribute must have * @return the <code>TagTester</code> for the child tag */ public TagTester getChild(String attribute, String value) { TagTester childTag = null; if (openTag.isOpen()) { // Generate the markup for this tag String markup = getMarkup(); if (Strings.isEmpty(markup) == false) { childTag = TagTester.createTagByAttribute(markup, attribute, value); } } return childTag; }
/** * Checks if the tag has a child with the given <code>tagName</code>. * * @param tagName * the tag name to search for * @return <code>true</code> if this tag has a child with the given <code>tagName</code>. */ public TagTester getChild(String tagName) { Args.notNull(tagName, "tagName"); TagTester childTagTester = null; if (openTag.isOpen()) { // Get the content of the tag int startPos = openTag.getPos() + openTag.getLength(); int endPos = closeTag.getPos(); String markup = parser.getInput(startPos, endPos).toString(); childTagTester = createTagByAttribute(markup, tagName); } return childTagTester; }
TagTester.createTagByAttribute( html, "wicketPath",