    001    package org.apache.turbine.util;
    002
    003
    004    /*
    005     * Licensed to the Apache Software Foundation (ASF) under one
    006     * or more contributor license agreements.  See the NOTICE file
    007     * distributed with this work for additional information
    008     * regarding copyright ownership.  The ASF licenses this file
    009     * to you under the Apache License, Version 2.0 (the
    010     * "License"); you may not use this file except in compliance
    011     * with the License.  You may obtain a copy of the License at
    012     *
    013     *   http://www.apache.org/licenses/LICENSE-2.0
    014     *
    015     * Unless required by applicable law or agreed to in writing,
    016     * software distributed under the License is distributed on an
    017     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    018     * KIND, either express or implied.  See the License for the
    019     * specific language governing permissions and limitations
    020     * under the License.
    021     */
    022
    023
    024    import org.apache.turbine.test.BaseTestCase;
    025
    026    public class FormMessageTest
    027        extends BaseTestCase
    028    {
    029        public FormMessageTest(String name)
    030                throws Exception
    031        {
    032            super(name);
    033        }
    034
    035        public void testCreateFormMessage()
    036        {
    037            FormMessage fm = new FormMessage("mainForm","someField","A message!");
    038            String fmString = fm.toString();
    039            assertTrue("Make sure toString works",fmString.indexOf("someField")>-1);
    040            assertTrue("Make sure toString works",fmString.indexOf("A message")>-1);
    041            assertTrue("Make sure toString works",fmString.indexOf("mainForm")>-1);
    042        }
    043
    044        public void testCreateFormMessageMultipleFields()
    045        {
    046            FormMessage fm = new FormMessage("mainForm","someField","A message!");
    047            fm.setFieldName("someOtherField");
    048            String fmString = fm.toString();
    049            assertTrue("Make sure toString works",fmString.indexOf("someField")>-1);
    050            assertTrue("Make sure toString works",fmString.indexOf("someOtherField")>-1);
    051            assertTrue("Make sure toString works",fmString.indexOf("A message")>-1);
    052            assertTrue("Make sure toString works",fmString.indexOf("mainForm")>-1);
    053        }
    054    }