Quick Search:

View

Revision:

Diff

Diff from 1243 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/jdave/trunk/jdave-wicket/src/test/jdave/wicket/NonFormComponentSpec.java

Annotated File View

tkarkk
1243
1 /*
2  * Copyright 2009 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package jdave.wicket;
17
18 import jdave.Block;
19 import jdave.junit4.JDaveRunner;
20 import org.apache.wicket.markup.html.basic.Label;
21 import org.apache.wicket.model.IModel;
22 import org.apache.wicket.model.Model;
23 import org.junit.runner.RunWith;
24
25 /**
26  * @author Tuomas K��rkk��inen
27  */
28 @RunWith(JDaveRunner.class)
29 public class NonFormComponentSpec extends ComponentSpecification<LabelString> {
30
31     @Override
32     protected Label newComponent(final String idfinal IModel<Stringmodel) {
33         return new Label(idmodel);
34     }
35
36     public class FormStarting {
37         public void makesNoSense() {
38             specify(
39                     new Block() {
40                         public void run() throws Throwable {
41                             startForm(new Model<String>(), "");
42                         }
43                     },
44                     must
45                             .raise(
46                                     IllegalArgumentException.class,
47                                     "Your ComponentSpecification must be typed as <? extends Form<?>> if you want to start a form.  Instead you are using org.apache.wicket.markup.html.basic.Label"));
48         }
49     }
50
51 }