/** * 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 such 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 */ public static TagTester createTagByAttribute(String markup, String attribute, String value) { List<TagTester> tester = createTagsByAttribute(markup, attribute, value, true); if ((tester == null) || (tester.size() == 0)) { return null; } return tester.get(0); }
/** * Modified version of BaseWicketTester#getTagByWicketId(String) that returns all matching tags * instead of just the first. * * @param wicketId * @return List of Tags */ public List<TagTester> getTagsByWicketId(String wicketId) { return TagTester.createTagsByAttribute(getLastResponseAsString(), "wicket:id", wicketId, false); }
/** * Modified version of BaseWicketTester#getTagByWicketId(String) that returns all matching tags * instead of just the first. * * @param wicketId * @return List of Tags */ public List<TagTester> getTagsByWicketId(String wicketId) { return TagTester.createTagsByAttribute(getLastResponseAsString(), "wicket:id", wicketId, false); }
/** * 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 such 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 */ public static TagTester createTagByAttribute(String markup, String attribute, String value) { List<TagTester> tester = createTagsByAttribute(markup, attribute, value, true); if ((tester == null) || (tester.size() == 0)) { return null; } return tester.get(0); }
/** * 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 * @param stopAfterFirst * if true search will stop after the first match * @return the <code>TagTester</code> which matches the tag in the markup, that has the given * value on the given attribute */ public static TagTester createTagsByAttribute(String markup, String attribute, String value) { List<TagTester> tester = createTagsByAttribute(markup, attribute, value, true); if ((tester == null) || (tester.size() == 0)) { return null; } return tester.get(0); }
/** * Modified version of BaseWicketTester#getTagByWicketId(String) that returns all matching tags * instead of just the first. * * @see BaseWicketTester#getTagByWicketId(String) */ public static List<TagTester> getTagsByWicketId(WicketTester tester, String wicketId) { return TagTester.createTagsByAttribute(tester.getServletResponse().getDocument(), "wicket:id", wicketId, false); }