Buggy code:
public class CheckGroupTest extends WicketTestCase { public CheckGroupTest ( String name ) { } public static class MockModelObject implements Serializable { private static final long serialVersionUID = 1L ; private Set prop1 = new HashSet ( ) ; private String prop2 ; public Set getProp1 ( ) { } public void setProp1 ( Set prop1 ) { } public String getProp2 ( ) { } public void setProp2 ( String prop2 ) { } } public void testFormProcessing ( ) { CheckGroupTest . MockModelObject modelObject = new CheckGroupTest . MockModelObject ( ) ; MockCheckGroupTestFormPage page = new MockCheckGroupTestFormPage ( ) ; final Form < CheckGroupTest . MockModelObject > form = new Form < CheckGroupTest . MockModelObject > ( page , "form" , new wicket . model . CompoundPropertyModel < CheckGroupTest . MockModelObject > ( modelObject ) ) ; final CheckGroup group = new CheckGroup ( form , "prop1" ) ; final WebMarkupContainer container = new WebMarkupContainer ( group , "container" ) ; final String check1 = "check1-selection" ; final String check2 = "check2-selection" ; List list = new ArrayList ( ) ; <START_BUG> Model model = new Model ( ( ( Serializable ) ( list ) ) ) ; <END_BUG> final CheckGroup group2 = new CheckGroup ( group , "group2" , model ) ; assertTrue ( ( ( group2 . getModelObject ( ) ) == list ) ) ; final CheckGroup group3 = new CheckGroup ( form , "group3" , list ) ; assertTrue ( ( ( group3 . getModelObject ( ) ) == list ) ) ; application . createRequestCycle ( ) ; new Check ( container , "check1" , new Model ( check1 ) ) ; new Check ( group , "prop2" ) ; modelObject . setProp2 ( check2 ) ; modelObject . getProp1 ( ) . add ( check1 ) ; form . onFormSubmitted ( ) ; assertTrue ( "running<seq2seq4repair_space>with<seq2seq4repair_space>nothing<seq2seq4repair_space>selected<seq2seq4repair_space>-<seq2seq4repair_space>model<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>empty" , ( ( modelObject . getProp1 ( ) . size ( ) ) == 0 ) ) ; application . getServletRequest ( ) . setParameter ( group . getInputName ( ) , "container:check1" ) ; form . onFormSubmitted ( ) ; assertTrue ( "running<seq2seq4repair_space>with<seq2seq4repair_space>choice1<seq2seq4repair_space>selected<seq2seq4repair_space>-<seq2seq4repair_space>model<seq2seq4repair_space>must<seq2seq4repair_space>only<seq2seq4repair_space>contain<seq2seq4repair_space>value<seq2seq4repair_space>of<seq2seq4repair_space>check1" , ( ( ( modelObject . getProp1 ( ) . size ( ) ) == 1 ) && ( modelObject . getProp1 ( ) . contains ( check1 ) ) ) ) ; application . getServletRequest ( ) . setParameter ( group . getInputName ( ) , "prop2" ) ; form . onFormSubmitted ( ) ; assertTrue ( "running<seq2seq4repair_space>with<seq2seq4repair_space>choice2<seq2seq4repair_space>selected<seq2seq4repair_space>-<seq2seq4repair_space>model<seq2seq4repair_space>must<seq2seq4repair_space>only<seq2seq4repair_space>contain<seq2seq4repair_space>value<seq2seq4repair_space>of<seq2seq4repair_space>check2" , ( ( ( modelObject . getProp1 ( ) . size ( ) ) == 1 ) && ( modelObject . getProp1 ( ) . contains ( check2 ) ) ) ) ; application . getServletRequest ( ) . getParameterMap ( ) . put ( group . getInputName ( ) , new String [ ] { null , "container:check1" , null , "prop2" } ) ; form . onFormSubmitted ( ) ; assertTrue ( "running<seq2seq4repair_space>with<seq2seq4repair_space>choice1<seq2seq4repair_space>and<seq2seq4repair_space>choice2<seq2seq4repair_space>selected<seq2seq4repair_space>-<seq2seq4repair_space>model<seq2seq4repair_space>must<seq2seq4repair_space>only<seq2seq4repair_space>contain<seq2seq4repair_space>values<seq2seq4repair_space>of<seq2seq4repair_space>check1<seq2seq4repair_space>and<seq2seq4repair_space>check2" , ( ( ( ( modelObject . getProp1 ( ) . size ( ) ) == 2 ) && ( modelObject . getProp1 ( ) . contains ( check2 ) ) ) && ( modelObject . getProp1 ( ) . contains ( check1 ) ) ) ) ; application . getServletRequest ( ) . getParameterMap ( ) . put ( group . getInputName ( ) , new String [ ] { "some<seq2seq4repair_space>weird<seq2seq4repair_space>path<seq2seq4repair_space>to<seq2seq4repair_space>test<seq2seq4repair_space>error" } ) ; try { form . onFormSubmitted ( ) ; fail ( "running<seq2seq4repair_space>with<seq2seq4repair_space>an<seq2seq4repair_space>invalid<seq2seq4repair_space>choice<seq2seq4repair_space>value<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>request<seq2seq4repair_space>param,<seq2seq4repair_space>should<seq2seq4repair_space>fail" ) ; } catch ( WicketRuntimeException e ) { } } public void testRendering ( ) throws Exception { } }

Fix:
Model model = new Model ( list ) ;