Search in sources :

Example 1 with ExactLevelFeedbackMessageFilter

use of org.apache.wicket.feedback.ExactLevelFeedbackMessageFilter in project wicket by apache.

the class BaseWicketTester method getMessages.

/**
 * Retrieves <code>FeedbackMessages</code>.
 *
 * @param level
 *            level of feedback message, for example:
 *            <code>FeedbackMessage.DEBUG or FeedbackMessage.INFO.. etc</code>
 * @return <code>List</code> of messages (as <code>String</code>s)
 * @see FeedbackMessage
 */
public List<Serializable> getMessages(final int level) {
    List<FeedbackMessage> messages = getFeedbackMessages(new ExactLevelFeedbackMessageFilter(level));
    List<Serializable> actualMessages = Generics.newArrayList();
    for (FeedbackMessage message : messages) {
        actualMessages.add(message.getMessage());
    }
    return actualMessages;
}
Also used : Serializable(java.io.Serializable) FeedbackMessage(org.apache.wicket.feedback.FeedbackMessage) ExactLevelFeedbackMessageFilter(org.apache.wicket.feedback.ExactLevelFeedbackMessageFilter)

Example 2 with ExactLevelFeedbackMessageFilter

use of org.apache.wicket.feedback.ExactLevelFeedbackMessageFilter in project wicket by apache.

the class WicketTesterTest method renderComponentRelativeErrorMessage.

/**
 * https://issues.apache.org/jira/browse/WICKET-5128
 */
@Test
public void renderComponentRelativeErrorMessage() {
    tester.startPage(new ComponentFeedbackResourceTestingPage());
    Component label = tester.getComponentFromLastRenderedPage("label");
    tester.assertComponentFeedbackMessage(label, "error.msg", null, new ExactLevelFeedbackMessageFilter(FeedbackMessage.ERROR));
}
Also used : ComponentFeedbackResourceTestingPage(org.apache.wicket.util.tester.apps_8.ComponentFeedbackResourceTestingPage) Component(org.apache.wicket.Component) IRequestableComponent(org.apache.wicket.request.component.IRequestableComponent) MockPageWithOneComponent(org.apache.wicket.MockPageWithOneComponent) FormComponent(org.apache.wicket.markup.html.form.FormComponent) ExactLevelFeedbackMessageFilter(org.apache.wicket.feedback.ExactLevelFeedbackMessageFilter) Test(org.junit.Test)

Example 3 with ExactLevelFeedbackMessageFilter

use of org.apache.wicket.feedback.ExactLevelFeedbackMessageFilter in project wicket by apache.

the class WicketTesterTest method renderComponentRelativeInfoMessage.

/**
 * https://issues.apache.org/jira/browse/WICKET-5128
 */
@Test
public void renderComponentRelativeInfoMessage() {
    tester.startPage(new ComponentFeedbackResourceTestingPage());
    Component label = tester.getComponentFromLastRenderedPage("label");
    tester.assertComponentFeedbackMessage(label, "info.msg", null, new ExactLevelFeedbackMessageFilter(FeedbackMessage.INFO));
}
Also used : ComponentFeedbackResourceTestingPage(org.apache.wicket.util.tester.apps_8.ComponentFeedbackResourceTestingPage) Component(org.apache.wicket.Component) IRequestableComponent(org.apache.wicket.request.component.IRequestableComponent) MockPageWithOneComponent(org.apache.wicket.MockPageWithOneComponent) FormComponent(org.apache.wicket.markup.html.form.FormComponent) ExactLevelFeedbackMessageFilter(org.apache.wicket.feedback.ExactLevelFeedbackMessageFilter) Test(org.junit.Test)

Aggregations

ExactLevelFeedbackMessageFilter (org.apache.wicket.feedback.ExactLevelFeedbackMessageFilter)3 Component (org.apache.wicket.Component)2 MockPageWithOneComponent (org.apache.wicket.MockPageWithOneComponent)2 FormComponent (org.apache.wicket.markup.html.form.FormComponent)2 IRequestableComponent (org.apache.wicket.request.component.IRequestableComponent)2 ComponentFeedbackResourceTestingPage (org.apache.wicket.util.tester.apps_8.ComponentFeedbackResourceTestingPage)2 Test (org.junit.Test)2 Serializable (java.io.Serializable)1 FeedbackMessage (org.apache.wicket.feedback.FeedbackMessage)1