Coverage Report - org.apache.tapestry5.test.TapestryTestCase
 
Classes in this File Line Coverage Branch Coverage Complexity
TapestryTestCase
80%
291/365
33%
2/6
0
TapestryTestCase$1
100%
6/6
75%
3/4
0
TapestryTestCase$2
100%
3/3
N/A
0
 
 1  
 // Copyright 2006, 2007, 2008, 2009 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry5.test;
 16  
 
 17  
 import org.apache.tapestry5.*;
 18  
 import org.apache.tapestry5.annotations.Id;
 19  
 import org.apache.tapestry5.annotations.Parameter;
 20  
 import org.apache.tapestry5.annotations.Path;
 21  
 import org.apache.tapestry5.beaneditor.BeanModel;
 22  
 import org.apache.tapestry5.beaneditor.PropertyModel;
 23  
 import org.apache.tapestry5.internal.services.MapMessages;
 24  
 import org.apache.tapestry5.internal.services.MarkupWriterImpl;
 25  
 import static org.apache.tapestry5.internal.test.CodeEq.codeEq;
 26  
 import org.apache.tapestry5.ioc.*;
 27  
 import org.apache.tapestry5.ioc.annotations.Inject;
 28  
 import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
 29  
 import static org.apache.tapestry5.ioc.internal.util.CollectionFactory.newList;
 30  
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 31  
 import org.apache.tapestry5.ioc.test.IOCTestCase;
 32  
 import org.apache.tapestry5.model.ComponentModel;
 33  
 import org.apache.tapestry5.model.EmbeddedComponentModel;
 34  
 import org.apache.tapestry5.model.MutableComponentModel;
 35  
 import org.apache.tapestry5.model.ParameterModel;
 36  
 import org.apache.tapestry5.runtime.Component;
 37  
 import org.apache.tapestry5.services.*;
 38  
 import org.easymock.EasyMock;
 39  
 import static org.easymock.EasyMock.eq;
 40  
 import org.easymock.IAnswer;
 41  
 
 42  
 import javax.servlet.ServletOutputStream;
 43  
 import javax.servlet.http.HttpServletRequest;
 44  
 import javax.servlet.http.HttpServletResponse;
 45  
 import javax.servlet.http.HttpSession;
 46  
 import java.io.*;
 47  
 import static java.lang.Thread.sleep;
 48  
 import java.lang.annotation.Annotation;
 49  
 import java.net.URL;
 50  
 import java.util.*;
 51  
 
 52  
 /**
 53  
  * Base test case that adds a number of convienience factory and training methods for the public interfaces of
 54  
  * Tapestry.
 55  
  */
 56  288
 public abstract class TapestryTestCase extends IOCTestCase
 57  
 {
 58  
 
 59  
     /**
 60  
      * Creates a new markup writer instance (not a markup writer mock). Output can be directed at the writer, which uses
 61  
      * the default (HTML) markup model. The writer's toString() value represents all the collected markup in the
 62  
      * writer.
 63  
      */
 64  
     protected final MarkupWriter createMarkupWriter()
 65  
     {
 66  12
         return new MarkupWriterImpl();
 67  
     }
 68  
 
 69  
     protected final void train_getAliasesForMode(AliasManager manager, String mode, Map<Class, Object> configuration)
 70  
     {
 71  12
         expect(manager.getAliasesForMode(mode)).andReturn(configuration);
 72  12
     }
 73  
 
 74  
     protected final ApplicationStateCreator mockApplicationStateCreator()
 75  
     {
 76  14
         return newMock(ApplicationStateCreator.class);
 77  
     }
 78  
 
 79  
     protected final ApplicationStatePersistenceStrategy mockApplicationStatePersistenceStrategy()
 80  
     {
 81  18
         return newMock(ApplicationStatePersistenceStrategy.class);
 82  
     }
 83  
 
 84  
     protected final ApplicationStatePersistenceStrategySource mockApplicationStatePersistenceStrategySource()
 85  
     {
 86  14
         return newMock(ApplicationStatePersistenceStrategySource.class);
 87  
     }
 88  
 
 89  
     protected final Asset mockAsset()
 90  
     {
 91  28
         return newMock(Asset.class);
 92  
     }
 93  
 
 94  
     protected final AssetFactory mockAssetFactory()
 95  
     {
 96  8
         return newMock(AssetFactory.class);
 97  
     }
 98  
 
 99  
     protected final AssetSource mockAssetSource()
 100  
     {
 101  16
         return newMock(AssetSource.class);
 102  
     }
 103  
 
 104  
     protected final Binding mockBinding()
 105  
     {
 106  16
         return newMock(Binding.class);
 107  
     }
 108  
 
 109  
     protected final BindingFactory mockBindingFactory()
 110  
     {
 111  10
         return newMock(BindingFactory.class);
 112  
     }
 113  
 
 114  
     protected final BindingSource mockBindingSource()
 115  
     {
 116  8
         return newMock(BindingSource.class);
 117  
     }
 118  
 
 119  
     protected final Block mockBlock()
 120  
     {
 121  10
         return newMock(Block.class);
 122  
     }
 123  
 
 124  
     protected final ClasspathAssetAliasManager mockClasspathAssetAliasManager()
 125  
     {
 126  22
         return newMock(ClasspathAssetAliasManager.class);
 127  
     }
 128  
 
 129  
     protected final ClassTransformation mockClassTransformation()
 130  
     {
 131  84
         return newMock(ClassTransformation.class);
 132  
     }
 133  
 
 134  
     protected final Component mockComponent()
 135  
     {
 136  98
         return newMock(Component.class);
 137  
     }
 138  
 
 139  
     protected final ComponentClassResolver mockComponentClassResolver()
 140  
     {
 141  88
         return newMock(ComponentClassResolver.class);
 142  
     }
 143  
 
 144  
     protected final ComponentEventCallback mockComponentEventHandler()
 145  
     {
 146  22
         return newMock(ComponentEventCallback.class);
 147  
     }
 148  
 
 149  
     protected final ComponentModel mockComponentModel()
 150  
     {
 151  90
         return newMock(ComponentModel.class);
 152  
     }
 153  
 
 154  
     protected final ComponentResources mockComponentResources()
 155  
     {
 156  244
         return newMock(ComponentResources.class);
 157  
     }
 158  
 
 159  
     protected final Context mockContext()
 160  
     {
 161  40
         return newMock(Context.class);
 162  
     }
 163  
 
 164  
     protected final Environment mockEnvironment()
 165  
     {
 166  18
         return newMock(Environment.class);
 167  
     }
 168  
 
 169  
     protected final Field mockField()
 170  
     {
 171  110
         return newMock(Field.class);
 172  
     }
 173  
 
 174  
     protected final FieldValidator mockFieldValidator()
 175  
     {
 176  12
         return newMock(FieldValidator.class);
 177  
     }
 178  
 
 179  
     protected FieldValidatorSource mockFieldValidatorSource()
 180  
     {
 181  10
         return newMock(FieldValidatorSource.class);
 182  
     }
 183  
 
 184  
     protected final Field mockFieldWithLabel(String label)
 185  
     {
 186  18
         Field field = mockField();
 187  
 
 188  18
         train_getLabel(field, label);
 189  
 
 190  18
         return field;
 191  
     }
 192  
 
 193  
     protected final Heartbeat mockHeartbeat()
 194  
     {
 195  2
         return newMock(Heartbeat.class);
 196  
     }
 197  
 
 198  
     protected final HttpServletRequest mockHttpServletRequest()
 199  
     {
 200  36
         return newMock(HttpServletRequest.class);
 201  
     }
 202  
 
 203  
     protected final HttpServletResponse mockHttpServletResponse()
 204  
     {
 205  12
         return newMock(HttpServletResponse.class);
 206  
     }
 207  
 
 208  
     protected final HttpSession mockHttpSession()
 209  
     {
 210  14
         return newMock(HttpSession.class);
 211  
     }
 212  
 
 213  
     protected final Inject mockInject()
 214  
     {
 215  0
         return newMock(Inject.class);
 216  
     }
 217  
 
 218  
     protected final Link mockLink()
 219  
     {
 220  48
         return newMock(Link.class);
 221  
     }
 222  
 
 223  
     protected final MarkupWriter mockMarkupWriter()
 224  
     {
 225  42
         return newMock(MarkupWriter.class);
 226  
     }
 227  
 
 228  
     protected final MutableComponentModel mockMutableComponentModel()
 229  
     {
 230  96
         return newMock(MutableComponentModel.class);
 231  
     }
 232  
 
 233  
     protected final ParameterModel mockParameterModel()
 234  
     {
 235  2
         return newMock(ParameterModel.class);
 236  
     }
 237  
 
 238  
     protected final Path mockPath()
 239  
     {
 240  4
         return newMock(Path.class);
 241  
     }
 242  
 
 243  
     protected final PropertyConduit mockPropertyConduit()
 244  
     {
 245  14
         return newMock(PropertyConduit.class);
 246  
     }
 247  
 
 248  
     protected final PropertyModel mockPropertyModel()
 249  
     {
 250  14
         return newMock(PropertyModel.class);
 251  
     }
 252  
 
 253  
     protected final Request mockRequest()
 254  
     {
 255  230
         return newMock(Request.class);
 256  
     }
 257  
 
 258  
     protected final RequestHandler mockRequestHandler()
 259  
     {
 260  14
         return newMock(RequestHandler.class);
 261  
     }
 262  
 
 263  
     protected final ResourceDigestGenerator mockResourceDigestGenerator()
 264  
     {
 265  8
         return newMock(ResourceDigestGenerator.class);
 266  
     }
 267  
 
 268  
     protected final Response mockResponse()
 269  
     {
 270  108
         return newMock(Response.class);
 271  
     }
 272  
 
 273  
     protected final Session mockSession()
 274  
     {
 275  18
         return newMock(Session.class);
 276  
     }
 277  
 
 278  
     protected final Translator mockTranslator()
 279  
     {
 280  20
         return newMock(Translator.class);
 281  
     }
 282  
 
 283  
     protected final ValidationConstraintGenerator mockValidationConstraintGenerator()
 284  
     {
 285  6
         return newMock(ValidationConstraintGenerator.class);
 286  
     }
 287  
 
 288  
     protected final ValidationMessagesSource mockValidationMessagesSource()
 289  
     {
 290  30
         return newMock(ValidationMessagesSource.class);
 291  
     }
 292  
 
 293  
     protected final ValidationTracker mockValidationTracker()
 294  
     {
 295  40
         return newMock(ValidationTracker.class);
 296  
     }
 297  
 
 298  
     protected final Validator mockValidator()
 299  
     {
 300  30
         return newMock(Validator.class);
 301  
     }
 302  
 
 303  
     /**
 304  
      * Writes a change to a file.
 305  
      */
 306  
     protected final void touch(File f) throws Exception
 307  
     {
 308  12
         long startModified = f.lastModified();
 309  
 
 310  
         while (true)
 311  
         {
 312  114
             OutputStream o = new FileOutputStream(f);
 313  114
             o.write(0);
 314  114
             o.close();
 315  
 
 316  114
             long newModified = f.lastModified();
 317  
 
 318  114
             if (newModified != startModified) return;
 319  
 
 320  
             // Sleep 1/20 second and try again
 321  
 
 322  102
             sleep(50);
 323  102
         }
 324  
     }
 325  
 
 326  
     protected final void train_addField(ClassTransformation transformation, int modifiers, String type,
 327  
                                         String suggestedName, String actualName)
 328  
     {
 329  0
         expect(transformation.addField(modifiers, type, suggestedName)).andReturn(actualName);
 330  0
     }
 331  
 
 332  
     protected final void train_addInjectedField(ClassTransformation ct, Class type, String suggestedName, Object value,
 333  
                                                 String fieldName)
 334  
     {
 335  4
         expect(ct.addInjectedField(type, suggestedName, value)).andReturn(fieldName);
 336  4
     }
 337  
 
 338  
     protected final void train_addMethod(ClassTransformation transformation, TransformMethodSignature signature,
 339  
                                          String... body)
 340  
     {
 341  0
         transformation.addMethod(eq(signature), codeEq(join(body)));
 342  0
     }
 343  
 
 344  
     protected final void train_buildConstraints(ValidationConstraintGenerator generator, Class propertyType,
 345  
                                                 AnnotationProvider provider, String... constraints)
 346  
     {
 347  6
         expect(generator.buildConstraints(propertyType, provider)).andReturn(Arrays.asList(constraints));
 348  6
     }
 349  
 
 350  
     protected final <T> void train_create(ApplicationStateCreator<T> creator, T aso)
 351  
     {
 352  2
         expect(creator.create()).andReturn(aso);
 353  2
     }
 354  
 
 355  
     protected final void train_createAsset(AssetFactory factory, Resource resource, Asset asset)
 356  
     {
 357  8
         expect(factory.createAsset(resource)).andReturn(asset);
 358  8
     }
 359  
 
 360  
     protected final void train_createValidator(FieldValidatorSource source, Field field, String validatorType,
 361  
                                                String constraintValue, String overrideId, Messages overrideMessages,
 362  
                                                Locale locale, FieldValidator result)
 363  
     {
 364  6
         expect(source.createValidator(field, validatorType, constraintValue, overrideId, overrideMessages,
 365  
                                       locale)).andReturn(result);
 366  6
     }
 367  
 
 368  
     protected final void train_encodeRedirectURL(Response response, String URI, String encoded)
 369  
     {
 370  2
         expect(response.encodeRedirectURL(URI)).andReturn(encoded);
 371  2
     }
 372  
 
 373  
     protected final void train_encodeURL(Response response, String inputURL, String outputURL)
 374  
     {
 375  12
         expect(response.encodeURL(inputURL)).andReturn(outputURL);
 376  12
     }
 377  
 
 378  
     protected final <T> void train_exists(ApplicationStatePersistenceStrategy strategy, Class<T> asoClass,
 379  
                                           boolean exists)
 380  
     {
 381  8
         expect(strategy.exists(asoClass)).andReturn(exists);
 382  8
     }
 383  
 
 384  
     protected final void train_extendConstructor(ClassTransformation transformation, String... body)
 385  
     {
 386  0
         transformation.extendConstructor(codeEq(join(body)));
 387  0
     }
 388  
 
 389  
     protected final void train_extendMethod(ClassTransformation transformation, TransformMethodSignature signature,
 390  
                                             String... body)
 391  
     {
 392  10
         transformation.extendMethod(eq(signature), codeEq(join(body)));
 393  10
     }
 394  
 
 395  
     protected final void train_getAsset(AssetSource source, Resource root, String path, Locale locale, Asset asset)
 396  
     {
 397  4
         expect(source.getAsset(root, path, locale)).andReturn(asset);
 398  4
     }
 399  
 
 400  
     protected final void train_findFieldsWithAnnotation(ClassTransformation transformation,
 401  
                                                         Class<? extends Annotation> annotationClass,
 402  
                                                         List<String> fieldNames)
 403  
     {
 404  32
         expect(transformation.findFieldsWithAnnotation(annotationClass)).andReturn(fieldNames);
 405  32
     }
 406  
 
 407  
     protected final void train_findFieldsWithAnnotation(ClassTransformation transformation,
 408  
                                                         Class<? extends Annotation> annotationClass,
 409  
                                                         String... fieldNames)
 410  
     {
 411  32
         train_findFieldsWithAnnotation(transformation, annotationClass, Arrays.asList(fieldNames));
 412  32
     }
 413  
 
 414  
     protected final void train_findMethods(ClassTransformation transformation,
 415  
                                            final TransformMethodSignature... signatures)
 416  
     {
 417  4
         IAnswer<List<TransformMethodSignature>> answer = new IAnswer<List<TransformMethodSignature>>()
 418  
         {
 419  8
             public List<TransformMethodSignature> answer() throws Throwable
 420  
             {
 421  
                 // Can't think of a way to do this without duplicating some code out of
 422  
                 // InternalClassTransformationImpl
 423  
 
 424  4
                 List<TransformMethodSignature> result = newList();
 425  4
                 MethodFilter filter = (MethodFilter) EasyMock.getCurrentArguments()[0];
 426  
 
 427  8
                 for (TransformMethodSignature sig : signatures)
 428  
                 {
 429  4
                     if (filter.accept(sig)) result.add(sig);
 430  
                 }
 431  
 
 432  
                 // We don't have to sort them for testing purposes. Usually there's just going to be
 433  
                 // one in there.
 434  
 
 435  4
                 return result;
 436  
             }
 437  
         };
 438  
 
 439  4
         expect(transformation.findMethods(EasyMock.isA(MethodFilter.class))).andAnswer(answer);
 440  4
     }
 441  
 
 442  
     protected final void train_findMethodsWithAnnotation(ClassTransformation tf,
 443  
                                                          Class<? extends Annotation> annotationType,
 444  
                                                          List<TransformMethodSignature> sigs)
 445  
     {
 446  0
         expect(tf.findMethodsWithAnnotation(annotationType)).andReturn(sigs);
 447  0
     }
 448  
 
 449  
     protected final void train_findUnclaimedFields(ClassTransformation transformation, String... fieldNames)
 450  
     {
 451  6
         expect(transformation.findUnclaimedFields()).andReturn(Arrays.asList(fieldNames));
 452  6
     }
 453  
 
 454  
     protected final void train_generateChecksum(ResourceDigestGenerator generator, URL url, String digest)
 455  
     {
 456  6
         expect(generator.generateDigest(url)).andReturn(digest);
 457  6
     }
 458  
 
 459  
     protected final <T> void train_get(ApplicationStatePersistenceStrategy strategy, Class<T> asoClass,
 460  
                                        ApplicationStateCreator<T> creator, T aso)
 461  
     {
 462  4
         expect(strategy.get(asoClass, creator)).andReturn(aso);
 463  4
     }
 464  
 
 465  
     protected final void train_get(ApplicationStatePersistenceStrategySource source, String strategyName,
 466  
                                    ApplicationStatePersistenceStrategy strategy)
 467  
     {
 468  14
         expect(source.get(strategyName)).andReturn(strategy).atLeastOnce();
 469  14
     }
 470  
 
 471  
     protected final void train_get(Binding binding, Object value)
 472  
     {
 473  8
         expect(binding.get()).andReturn(value);
 474  8
     }
 475  
 
 476  
     protected void train_getAttribute(HttpSession session, String attributeName, Object value)
 477  
     {
 478  2
         expect(session.getAttribute(attributeName)).andReturn(value);
 479  2
     }
 480  
 
 481  
     protected final void train_getAttribute(Session session, String name, Object attribute)
 482  
     {
 483  16
         expect(session.getAttribute(name)).andReturn(attribute);
 484  16
     }
 485  
 
 486  
     protected final void train_getAttributeNames(Session session, String prefix, String... names)
 487  
     {
 488  6
         expect(session.getAttributeNames(prefix)).andReturn(Arrays.asList(names));
 489  6
     }
 490  
 
 491  
     protected final void train_getBaseResource(ComponentModel model, Resource resource)
 492  
     {
 493  32
         expect(model.getBaseResource()).andReturn(resource).atLeastOnce();
 494  32
     }
 495  
 
 496  
     protected final void train_getClassName(ClassTransformation transformation, String className)
 497  
     {
 498  2
         expect(transformation.getClassName()).andReturn(className).atLeastOnce();
 499  2
     }
 500  
 
 501  
     protected final void train_getClasspathAsset(AssetSource source, String path, Asset asset)
 502  
     {
 503  0
         expect(source.getClasspathAsset(path)).andReturn(asset);
 504  0
     }
 505  
 
 506  
     protected final void train_getClasspathAsset(AssetSource source, String path, Locale locale, Asset asset)
 507  
     {
 508  0
         expect(source.getClasspathAsset(path, locale)).andReturn(asset);
 509  0
     }
 510  
 
 511  
     protected final void train_getCompleteId(ComponentResourcesCommon resources, String completeId)
 512  
     {
 513  100
         expect(resources.getCompleteId()).andReturn(completeId).atLeastOnce();
 514  100
     }
 515  
 
 516  
     protected final void train_getComponent(ComponentResources resources, Component component)
 517  
     {
 518  88
         expect(resources.getComponent()).andReturn(component).atLeastOnce();
 519  88
     }
 520  
 
 521  
     protected final void train_getComponentClassName(ComponentModel model, String className)
 522  
     {
 523  36
         expect(model.getComponentClassName()).andReturn(className).atLeastOnce();
 524  36
     }
 525  
 
 526  
     protected final void train_getComponentResources(Component component, ComponentResources resources)
 527  
     {
 528  32
         expect(component.getComponentResources()).andReturn(resources).atLeastOnce();
 529  32
     }
 530  
 
 531  
     protected final void train_getConduit(PropertyModel model, PropertyConduit conduit)
 532  
     {
 533  0
         expect(model.getConduit()).andReturn(conduit).atLeastOnce();
 534  0
     }
 535  
 
 536  
     protected <C, T> void train_getConstraintType(Validator<C, T> validator, Class<C> constraintType)
 537  
     {
 538  20
         expect(validator.getConstraintType()).andReturn(constraintType).atLeastOnce();
 539  20
     }
 540  
 
 541  
     protected final void train_getContainer(ComponentResources resources, Component container)
 542  
     {
 543  8
         expect(resources.getContainer()).andReturn(container).atLeastOnce();
 544  8
     }
 545  
 
 546  
     protected final void train_getContainerMessages(ComponentResources resources, Messages containerMessages)
 547  
     {
 548  26
         expect(resources.getContainerMessages()).andReturn(containerMessages).atLeastOnce();
 549  26
     }
 550  
 
 551  
     protected final void train_getContainerResources(ComponentResources resources,
 552  
                                                      ComponentResources containerResources)
 553  
     {
 554  14
         expect(resources.getContainerResources()).andReturn(containerResources).atLeastOnce();
 555  14
     }
 556  
 
 557  
     protected final void train_getDateHeader(Request request, String name, long value)
 558  
     {
 559  8
         expect(request.getDateHeader(name)).andReturn(value).atLeastOnce();
 560  8
     }
 561  
 
 562  
     protected final <T extends Annotation> void train_getFieldAnnotation(ClassTransformation transformation,
 563  
                                                                          String fieldName, Class<T> annotationClass,
 564  
                                                                          T annotation)
 565  
     {
 566  30
         expect(transformation.getFieldAnnotation(fieldName, annotationClass)).andReturn(annotation);
 567  30
     }
 568  
 
 569  
     protected final void train_getFieldPersistenceStrategy(ComponentModel model, String fieldName, String fieldStrategy)
 570  
     {
 571  8
         expect(model.getFieldPersistenceStrategy(fieldName)).andReturn(fieldStrategy).atLeastOnce();
 572  8
     }
 573  
 
 574  
     protected final void train_getFieldType(ClassTransformation transformation, String fieldName, String type)
 575  
     {
 576  22
         expect(transformation.getFieldType(fieldName)).andReturn(type).atLeastOnce();
 577  22
     }
 578  
 
 579  
     protected final void train_getId(ComponentResources resources, String id)
 580  
     {
 581  30
         expect(resources.getId()).andReturn(id).atLeastOnce();
 582  30
     }
 583  
 
 584  
     protected final void train_getLabel(Field field, String label)
 585  
     {
 586  26
         expect(field.getLabel()).andReturn(label).atLeastOnce();
 587  26
     }
 588  
 
 589  
     protected final void train_getLocale(ComponentResourcesCommon resources, Locale locale)
 590  
     {
 591  22
         expect(resources.getLocale()).andReturn(locale).atLeastOnce();
 592  22
     }
 593  
 
 594  
     protected final void train_getLocale(Request request, Locale locale)
 595  
     {
 596  4
         expect(request.getLocale()).andReturn(locale).atLeastOnce();
 597  4
     }
 598  
 
 599  
     protected void train_getMessageKey(Validator validator, String messageKey)
 600  
     {
 601  14
         expect(validator.getMessageKey()).andReturn(messageKey).atLeastOnce();
 602  14
     }
 603  
 
 604  
     protected final void train_getMessages(ComponentResources resources, Messages messages)
 605  
     {
 606  4
         expect(resources.getMessages()).andReturn(messages).atLeastOnce();
 607  4
     }
 608  
 
 609  
     protected final void train_getMeta(ComponentModel model, String key, String value)
 610  
     {
 611  18
         expect(model.getMeta(key)).andReturn(value).atLeastOnce();
 612  18
     }
 613  
 
 614  
     protected final <T extends Annotation> void train_getMethodAnnotation(ClassTransformation ct,
 615  
                                                                           TransformMethodSignature signature,
 616  
                                                                           Class<T> annotationClass, T annotation)
 617  
     {
 618  2
         expect(ct.getMethodAnnotation(signature, annotationClass)).andReturn(annotation)
 619  
                 .atLeastOnce();
 620  2
     }
 621  
 
 622  
     protected final void train_getMethodIdentifier(ClassTransformation transformation,
 623  
                                                    TransformMethodSignature signature, String id)
 624  
     {
 625  0
         expect(transformation.getMethodIdentifier(signature)).andReturn(id);
 626  0
     }
 627  
 
 628  
     protected final void train_getOutputStream(HttpServletResponse response, ServletOutputStream stream)
 629  
     {
 630  
         try
 631  
         {
 632  0
             expect(response.getOutputStream()).andReturn(stream);
 633  
         }
 634  0
         catch (IOException e)
 635  
         {
 636  0
             fail(e.getMessage(), e);
 637  0
         }
 638  0
     }
 639  
 
 640  
     protected final void train_getPage(ComponentResources resources, Component page)
 641  
     {
 642  4
         expect(resources.getPage()).andReturn(page).atLeastOnce();
 643  4
     }
 644  
 
 645  
     protected final void train_getParameterModel(ComponentModel model, String parameterName,
 646  
                                                  ParameterModel parameterModel)
 647  
     {
 648  4
         expect(model.getParameterModel(parameterName)).andReturn(parameterModel).atLeastOnce();
 649  4
     }
 650  
 
 651  
     protected final void train_getParameterNames(ComponentModel model, String... names)
 652  
     {
 653  2
         expect(model.getParameterNames()).andReturn(Arrays.asList(names));
 654  2
     }
 655  
 
 656  
     protected final void train_getParentModel(ComponentModel model, ComponentModel parentModel)
 657  
     {
 658  18
         expect(model.getParentModel()).andReturn(parentModel).atLeastOnce();
 659  18
     }
 660  
 
 661  
     protected final void train_getPath(Request request, String path)
 662  
     {
 663  128
         expect(request.getPath()).andReturn(path).atLeastOnce();
 664  128
     }
 665  
 
 666  
     protected final void train_getPersistentFieldNames(ComponentModel model, String... names)
 667  
     {
 668  2
         expect(model.getPersistentFieldNames()).andReturn(Arrays.asList(names)).atLeastOnce();
 669  2
     }
 670  
 
 671  
     protected final void train_getResourcesFieldName(ClassTransformation transformation, String name)
 672  
     {
 673  16
         expect(transformation.getResourcesFieldName()).andReturn(name).atLeastOnce();
 674  16
     }
 675  
 
 676  
     protected final void train_getRootResource(AssetFactory factory, Resource rootResource)
 677  
     {
 678  8
         expect(factory.getRootResource()).andReturn(rootResource);
 679  8
     }
 680  
 
 681  
     protected final void train_getSession(HttpServletRequest request, boolean create, HttpSession session)
 682  
     {
 683  6
         expect(request.getSession(create)).andReturn(session);
 684  6
     }
 685  
 
 686  
     protected void train_getSession(Request request, boolean create, Session session)
 687  
     {
 688  28
         expect(request.getSession(create)).andReturn(session);
 689  28
     }
 690  
 
 691  
     protected final void train_getSupportsInformalParameters(ComponentModel model, boolean supports)
 692  
     {
 693  0
         expect(model.getSupportsInformalParameters()).andReturn(supports).atLeastOnce();
 694  0
     }
 695  
 
 696  
     protected final void train_getValidationMessages(ValidationMessagesSource messagesSource, Locale locale,
 697  
                                                      Messages messages)
 698  
     {
 699  16
         expect(messagesSource.getValidationMessages(locale)).andReturn(messages).atLeastOnce();
 700  16
     }
 701  
 
 702  
     protected final void train_getValueType(Validator validator, Class valueType)
 703  
     {
 704  20
         expect(validator.getValueType()).andReturn(valueType).atLeastOnce();
 705  20
     }
 706  
 
 707  
     @SuppressWarnings("unchecked")
 708  
     protected final void train_handleResult(ComponentEventCallback handler, Object result,
 709  
                                             boolean abort)
 710  
     {
 711  4
         expect(handler.handleResult(result)).andReturn(abort);
 712  4
     }
 713  
 
 714  
     protected final void train_inError(ValidationTracker tracker, Field field, boolean inError)
 715  
     {
 716  16
         expect(tracker.inError(field)).andReturn(inError);
 717  16
     }
 718  
 
 719  
     protected final void train_isRequired(Validator validator, boolean isRequired)
 720  
     {
 721  26
         expect(validator.isRequired()).andReturn(isRequired).atLeastOnce();
 722  26
     }
 723  
 
 724  
     protected final void train_isInvariant(Binding binding, boolean isInvariant)
 725  
     {
 726  4
         expect(binding.isInvariant()).andReturn(isInvariant);
 727  4
     }
 728  
 
 729  
     protected final void train_isRequired(ParameterModel model, boolean isRequired)
 730  
     {
 731  0
         expect(model.isRequired()).andReturn(isRequired);
 732  0
     }
 733  
 
 734  
     protected final void train_isRootClass(MutableComponentModel model, boolean isRootClass)
 735  
     {
 736  0
         expect(model.isRootClass()).andReturn(isRootClass);
 737  0
     }
 738  
 
 739  
     protected final void train_name(Parameter parameter, String name)
 740  
     {
 741  0
         expect(parameter.name()).andReturn(name).atLeastOnce();
 742  0
     }
 743  
 
 744  
     protected final void train_newBinding(BindingFactory factory, String description, ComponentResources container,
 745  
                                           ComponentResources component, String expression, Location l, Binding binding)
 746  
     {
 747  6
         expect(factory.newBinding(description, container, component, expression, l)).andReturn(binding);
 748  6
     }
 749  
 
 750  
     protected void train_newBinding(BindingSource bindingSource, String description,
 751  
                                     ComponentResources componentResources, String defaultBindingPrefix,
 752  
                                     String expression, Binding binding)
 753  
     {
 754  2
         expect(bindingSource.newBinding(description, componentResources, defaultBindingPrefix, expression)).andReturn(
 755  
                 binding);
 756  2
     }
 757  
 
 758  
     protected final void train_newMemberName(ClassTransformation transformation, String suggested, String name)
 759  
     {
 760  0
         expect(transformation.newMemberName(suggested)).andReturn(name);
 761  0
     }
 762  
 
 763  
     protected final void train_newMemberName(ClassTransformation transformation, String prefix, String baseName,
 764  
                                              String name)
 765  
     {
 766  0
         expect(transformation.newMemberName(prefix, baseName)).andReturn(name);
 767  0
     }
 768  
 
 769  
     protected final <T> void train_peek(Environment env, Class<T> type, T value)
 770  
     {
 771  0
         expect(env.peek(type)).andReturn(value);
 772  0
     }
 773  
 
 774  
     protected final <T> void train_peekRequired(Environment env, Class<T> type, T value)
 775  
     {
 776  12
         expect(env.peekRequired(type)).andReturn(value);
 777  12
     }
 778  
 
 779  
     protected final void train_provideInjection(InjectionProvider provider, String fieldName, Class fieldType,
 780  
                                                 ObjectLocator locator, ClassTransformation transformation,
 781  
                                                 MutableComponentModel model, boolean result)
 782  
     {
 783  4
         expect(provider.provideInjection(fieldName, fieldType, locator, transformation, model))
 784  
                 .andReturn(result);
 785  4
     }
 786  
 
 787  
     @SuppressWarnings("unchecked")
 788  
     protected final void train_renderInformalParameters(ComponentResources resources, final MarkupWriter writer,
 789  
                                                         final Object... informals)
 790  
     {
 791  2
         resources.renderInformalParameters(writer);
 792  2
         IAnswer answer = new IAnswer()
 793  
         {
 794  2
             public Object answer() throws Throwable
 795  
             {
 796  2
                 writer.attributes(informals);
 797  
 
 798  2
                 return null;
 799  
             }
 800  
         };
 801  
 
 802  2
         setAnswer(answer);
 803  2
     }
 804  
 
 805  
     protected final void train_requiresDigest(ResourceDigestGenerator generator, String path, boolean requiresDigest)
 806  
     {
 807  10
         expect(generator.requiresDigest(path)).andReturn(requiresDigest);
 808  10
     }
 809  
 
 810  
     protected final void train_service(RequestHandler handler, Request request, Response response, boolean result)
 811  
             throws IOException
 812  
     {
 813  6
         expect(handler.service(request, response)).andReturn(result);
 814  6
     }
 815  
 
 816  
     protected final void train_setContentLength(HttpServletResponse response, int length)
 817  
     {
 818  0
         response.setContentLength(length);
 819  0
     }
 820  
 
 821  
     protected final void train_setContentType(HttpServletResponse response, String contentType)
 822  
     {
 823  0
         response.setContentType(contentType);
 824  0
     }
 825  
 
 826  
     protected final void train_setDateHeader(HttpServletResponse response, String headerName, long date)
 827  
     {
 828  0
         response.setDateHeader(headerName, date);
 829  0
     }
 830  
 
 831  
     protected final void train_toClass(ClassTransformation transformation, String type, Class classForType)
 832  
     {
 833  6
         expect(transformation.toClass(type)).andReturn(classForType);
 834  6
     }
 835  
 
 836  
     protected final void train_toClientURL(Asset asset, String URL)
 837  
     {
 838  18
         expect(asset.toClientURL()).andReturn(URL).atLeastOnce();
 839  18
     }
 840  
 
 841  
     protected final void train_toClientURL(ClasspathAssetAliasManager manager, String resourcePath, String clientURL)
 842  
     {
 843  8
         expect(manager.toClientURL(resourcePath)).andReturn(clientURL);
 844  8
     }
 845  
 
 846  
     protected final void train_toRedirectURI(Link link, String URI)
 847  
     {
 848  0
         expect(link.toRedirectURI()).andReturn(URI).atLeastOnce();
 849  0
     }
 850  
 
 851  
     protected final void train_toResourcePath(ClasspathAssetAliasManager manager, String clientURL, String resourcePath)
 852  
     {
 853  16
         expect(manager.toResourcePath(clientURL)).andReturn(resourcePath).atLeastOnce();
 854  16
     }
 855  
 
 856  
     protected final void train_value(Id annotation, String value)
 857  
     {
 858  2
         expect(annotation.value()).andReturn(value).atLeastOnce();
 859  2
     }
 860  
 
 861  
     protected final void train_value(Path annotation, String value)
 862  
     {
 863  4
         expect(annotation.value()).andReturn(value).atLeastOnce();
 864  4
     }
 865  
 
 866  
     protected final void train_create(BeanModelSource source, Class beanClass, boolean filterReadOnly,
 867  
                                       Messages messages, BeanModel model)
 868  
     {
 869  0
         expect(source.create(beanClass, filterReadOnly, messages)).andReturn(model);
 870  0
     }
 871  
 
 872  
     protected final void train_getBoundType(ComponentResources resources, String parameterName, Class type)
 873  
     {
 874  6
         expect(resources.getBoundType(parameterName)).andReturn(type);
 875  6
     }
 876  
 
 877  
     protected final BeanModel mockBeanModel()
 878  
     {
 879  20
         return newMock(BeanModel.class);
 880  
     }
 881  
 
 882  
     protected final BeanModelSource mockBeanModelSource()
 883  
     {
 884  8
         return newMock(BeanModelSource.class);
 885  
     }
 886  
 
 887  
     public final void train_getLocation(Locatable locatable, Location location)
 888  
     {
 889  4
         expect(locatable.getLocation()).andReturn(location).atLeastOnce();
 890  4
     }
 891  
 
 892  
     public final void train_getResource(Location location, Resource resource)
 893  
     {
 894  0
         expect(location.getResource()).andReturn(resource).atLeastOnce();
 895  0
     }
 896  
 
 897  
     public final void train_getLine(Location location, int line)
 898  
     {
 899  0
         expect(location.getLine()).andReturn(line).atLeastOnce();
 900  0
     }
 901  
 
 902  
     protected final void train_getParameter(Request request, String elementName, String value)
 903  
     {
 904  70
         expect(request.getParameter(elementName)).andReturn(value).atLeastOnce();
 905  70
     }
 906  
 
 907  
     protected final void train_getPageName(ComponentResourcesCommon resources, String pageName)
 908  
     {
 909  16
         expect(resources.getPageName()).andReturn(pageName).atLeastOnce();
 910  16
     }
 911  
 
 912  
     protected final FormSupport mockFormSupport()
 913  
     {
 914  28
         return newMock(FormSupport.class);
 915  
     }
 916  
 
 917  
     /**
 918  
      * Provides access to component messages, suitable for testing. Reads the associated .properties file for the class
 919  
      * (NOT any localization of it). Only the messages directly in the .properties file is available.
 920  
      *
 921  
      * @param componentClass component class whose messages are needed *
 922  
      * @return the Messages instance
 923  
      */
 924  
     protected final Messages messagesFor(Class componentClass) throws IOException
 925  
     {
 926  0
         String file = componentClass.getSimpleName() + ".properties";
 927  
 
 928  0
         Properties properties = new Properties();
 929  
 
 930  0
         InputStream is = null;
 931  
 
 932  
         try
 933  
         {
 934  0
             is = componentClass.getResourceAsStream(file);
 935  
 
 936  0
             if (is == null) throw new RuntimeException(
 937  
                     String.format("Class %s does not have a message catalog.", componentClass.getName()));
 938  
 
 939  0
             properties.load(is);
 940  
         }
 941  
         finally
 942  
         {
 943  0
             InternalUtils.close(is);
 944  0
         }
 945  
 
 946  0
         Map<String, String> map = CollectionFactory.newCaseInsensitiveMap();
 947  
 
 948  0
         for (Object key : properties.keySet())
 949  
         {
 950  
 
 951  0
             String skey = (String) key;
 952  
 
 953  0
             map.put(skey, properties.getProperty(skey));
 954  0
         }
 955  
 
 956  0
         return new MapMessages(Locale.ENGLISH, map);
 957  
     }
 958  
 
 959  
     protected final FieldValidationSupport mockFieldValidationSupport()
 960  
     {
 961  0
         return newMock(FieldValidationSupport.class);
 962  
     }
 963  
 
 964  
     protected final RenderSupport mockRenderSupport()
 965  
     {
 966  22
         return newMock(RenderSupport.class);
 967  
     }
 968  
 
 969  
     protected final void train_getInheritInformalParameters(EmbeddedComponentModel model, boolean inherits)
 970  
     {
 971  0
         expect(model.getInheritInformalParameters()).andReturn(inherits).atLeastOnce();
 972  0
     }
 973  
 
 974  
     protected final ApplicationStateManager mockApplicationStateManager()
 975  
     {
 976  6
         return newMock(ApplicationStateManager.class);
 977  
     }
 978  
 
 979  
     protected final <T> void train_get(ApplicationStateManager manager, Class<T> asoClass, T aso)
 980  
     {
 981  2
         expect(manager.get(asoClass)).andReturn(aso);
 982  2
     }
 983  
 
 984  
     protected final void train_getInput(ValidationTracker tracker, Field field, String input)
 985  
     {
 986  18
         expect(tracker.getInput(field)).andReturn(input);
 987  18
     }
 988  
 
 989  
     protected final void train_isXHR(Request request, boolean isXHR)
 990  
     {
 991  56
         expect(request.isXHR()).andReturn(isXHR).atLeastOnce();
 992  56
     }
 993  
 
 994  
     protected void train_getPathInfo(HttpServletRequest request, String pathInfo)
 995  
     {
 996  6
         expect(request.getPathInfo()).andReturn(pathInfo).atLeastOnce();
 997  6
     }
 998  
 
 999  
     protected final void train_service(HttpServletRequestHandler handler, HttpServletRequest request,
 1000  
                                        HttpServletResponse response, boolean result) throws IOException
 1001  
     {
 1002  4
         expect(handler.service(request, response)).andReturn(result);
 1003  4
     }
 1004  
 
 1005  
     protected final void train_getServletPath(HttpServletRequest request, String path)
 1006  
     {
 1007  6
         expect(request.getServletPath()).andReturn(path).atLeastOnce();
 1008  6
     }
 1009  
 
 1010  
     protected final HttpServletRequestHandler mockHttpServletRequestHandler()
 1011  
     {
 1012  6
         return newMock(HttpServletRequestHandler.class);
 1013  
     }
 1014  
 
 1015  
     protected final NullFieldStrategy mockNullFieldStrategy()
 1016  
     {
 1017  20
         return newMock(NullFieldStrategy.class);
 1018  
     }
 1019  
 
 1020  
     protected final ValueEncoderSource mockValueEncoderSource()
 1021  
     {
 1022  4
         return newMock(ValueEncoderSource.class);
 1023  
     }
 1024  
 
 1025  
     protected final ValueEncoder mockValueEncoder()
 1026  
     {
 1027  4
         return newMock(ValueEncoder.class);
 1028  
     }
 1029  
 
 1030  
     protected final void train_toClient(ValueEncoder valueEncoder, Object value, String encoded)
 1031  
     {
 1032  2
         expect(valueEncoder.toClient(value)).andReturn(encoded);
 1033  2
     }
 1034  
 
 1035  
     protected final void train_getValueEncoder(ValueEncoderSource source, Class type, ValueEncoder valueEncoder)
 1036  
     {
 1037  4
         expect(source.getValueEncoder(type)).andReturn(valueEncoder).atLeastOnce();
 1038  4
     }
 1039  
 
 1040  
     protected final void train_toValue(ValueEncoder valueEncoder, String clientValue, Object value)
 1041  
     {
 1042  2
         expect(valueEncoder.toValue(clientValue)).andReturn(value);
 1043  2
     }
 1044  
 
 1045  
     protected <T> void train_findMeta(MetaDataLocator locator, String key,
 1046  
                                       ComponentResources resources, Class<T> expectedType, T value)
 1047  
     {
 1048  4
         expect(locator.findMeta(key, resources, expectedType)).andReturn(value).atLeastOnce();
 1049  4
     }
 1050  
 
 1051  
     protected MetaDataLocator mockMetaDataLocator()
 1052  
     {
 1053  18
         return newMock(MetaDataLocator.class);
 1054  
     }
 1055  
 
 1056  
     protected final void train_isSecure(Request request, boolean isSecure)
 1057  
     {
 1058  14
         expect(request.isSecure()).andReturn(isSecure).atLeastOnce();
 1059  14
     }
 1060  
 
 1061  
     protected final void train_getBaseURL(BaseURLSource baseURLSource, boolean secure, String baseURL)
 1062  
     {
 1063  4
         expect(baseURLSource.getBaseURL(secure)).andReturn(baseURL);
 1064  4
     }
 1065  
 
 1066  
     protected final BaseURLSource mockBaseURLSource()
 1067  
     {
 1068  14
         return newMock(BaseURLSource.class);
 1069  
     }
 1070  
 
 1071  
     protected final void train_getAttribute(Request request, String attibuteName, Object value)
 1072  
     {
 1073  54
         expect(request.getAttribute(attibuteName)).andReturn(value);
 1074  54
     }
 1075  
 
 1076  
     protected final void train_getBlockParameter(ComponentResources resources, String name, Block block)
 1077  
     {
 1078  4
         expect(resources.getBlockParameter(name)).andReturn(block).atLeastOnce();
 1079  4
     }
 1080  
 
 1081  
     protected final PropertyOverrides mockPropertyOverrides()
 1082  
     {
 1083  10
         return newMock(PropertyOverrides.class);
 1084  
     }
 1085  
 
 1086  
     protected void train_getOverrideBlock(PropertyOverrides overrides, String name, Block block)
 1087  
     {
 1088  2
         expect(overrides.getOverrideBlock(name)).andReturn(block).atLeastOnce();
 1089  2
     }
 1090  
 
 1091  
     protected final void train_getOverrideMessages(PropertyOverrides overrides, Messages messages)
 1092  
     {
 1093  6
         expect(overrides.getOverrideMessages()).andReturn(messages);
 1094  6
     }
 1095  
 
 1096  
     protected final void train_isDisabled(Field field, boolean disabled)
 1097  
     {
 1098  8
         expect(field.isDisabled()).andReturn(disabled);
 1099  8
     }
 1100  
 
 1101  
     protected final ValidationDecorator mockValidationDecorator()
 1102  
     {
 1103  8
         return newMock(ValidationDecorator.class);
 1104  
     }
 1105  
 
 1106  
     protected final void train_isRequired(Field field, boolean required)
 1107  
     {
 1108  4
         expect(field.isRequired()).andReturn(required);
 1109  4
     }
 1110  
 
 1111  
     protected final void train_getClientId(ClientElement element, String clientId)
 1112  
     {
 1113  6
         expect(element.getClientId()).andReturn(clientId);
 1114  6
     }
 1115  
 
 1116  
     protected final FieldTranslator mockFieldTranslator()
 1117  
     {
 1118  18
         return newMock(FieldTranslator.class);
 1119  
     }
 1120  
 
 1121  
 
 1122  
     protected final Translator mockTranslator(String name, Class type)
 1123  
     {
 1124  20
         Translator translator = mockTranslator();
 1125  
 
 1126  20
         train_getName(translator, name);
 1127  20
         train_getType(translator, type);
 1128  
 
 1129  20
         return translator;
 1130  
     }
 1131  
 
 1132  
     protected final void train_getName(Translator translator, String name)
 1133  
     {
 1134  20
         expect(translator.getName()).andReturn(name).atLeastOnce();
 1135  20
     }
 1136  
 
 1137  
     protected final void train_getType(Translator translator, Class type)
 1138  
     {
 1139  20
         expect(translator.getType()).andReturn(type).atLeastOnce();
 1140  20
     }
 1141  
 
 1142  
     protected final void train_createDefaultTranslator(FieldTranslatorSource source, ComponentResources resources,
 1143  
                                                        String parameterName, FieldTranslator translator)
 1144  
     {
 1145  4
         expect(source.createDefaultTranslator(resources, parameterName)).andReturn(translator);
 1146  4
     }
 1147  
 
 1148  
     protected final TranslatorSource mockTranslatorSource()
 1149  
     {
 1150  10
         return newMock(TranslatorSource.class);
 1151  
     }
 1152  
 
 1153  
     protected final void train_get(TranslatorSource translatorSource, String name, Translator translator)
 1154  
     {
 1155  2
         expect(translatorSource.get(name)).andReturn(translator).atLeastOnce();
 1156  2
     }
 1157  
 
 1158  
     protected final void train_getMessageKey(Translator translator, String messageKey)
 1159  
     {
 1160  4
         expect(translator.getMessageKey()).andReturn(messageKey).atLeastOnce();
 1161  4
     }
 1162  
 
 1163  
     protected final void train_findByType(TranslatorSource ts, Class propertyType, Translator translator)
 1164  
     {
 1165  8
         expect(ts.findByType(propertyType)).andReturn(translator);
 1166  8
     }
 1167  
 
 1168  
     protected final void train_toURI(Link link, String URI)
 1169  
     {
 1170  4
         expect(link.toURI()).andReturn(URI);
 1171  4
     }
 1172  
 
 1173  
     protected final void train_createEditModel(BeanModelSource source, Class beanClass, Messages messages,
 1174  
                                                BeanModel model)
 1175  
     {
 1176  6
         expect(source.createEditModel(beanClass, messages)).andReturn(model);
 1177  6
     }
 1178  
 
 1179  
     protected final ComponentEventResultProcessor mockComponentEventResultProcessor()
 1180  
     {
 1181  4
         return newMock(ComponentEventResultProcessor.class);
 1182  
     }
 1183  
 
 1184  
     protected final void train_getFormComponentId(FormSupport formSupport, String componentId)
 1185  
     {
 1186  0
         expect(formSupport.getFormComponentId()).andReturn(componentId).atLeastOnce();
 1187  0
     }
 1188  
 
 1189  
     protected final void train_getFormValidationId(FormSupport formSupport, String validationId)
 1190  
     {
 1191  26
         expect(formSupport.getFormValidationId()).andReturn(validationId).atLeastOnce();
 1192  26
     }
 1193  
 
 1194  
     protected final void train_isAllowNull(ParameterModel model, boolean allowNull)
 1195  
     {
 1196  0
         expect(model.isAllowNull()).andReturn(allowNull).atLeastOnce();
 1197  0
     }
 1198  
 
 1199  
     protected final void train_isInvalidated(Session session, boolean invalidated)
 1200  
     {
 1201  0
         expect(session.isInvalidated()).andReturn(invalidated);
 1202  0
     }
 1203  
 
 1204  
     protected final ComponentEventRequestHandler mockComponentEventRequestHandler()
 1205  
     {
 1206  0
         return newMock(ComponentEventRequestHandler.class);
 1207  
     }
 1208  
 
 1209  
     protected final ComponentRequestHandler mockComponentRequestHandler()
 1210  
     {
 1211  24
         return newMock(ComponentRequestHandler.class);
 1212  
     }
 1213  
 
 1214  
     protected final Asset2 mockAsset2()
 1215  
     {
 1216  2
         return newMock(Asset2.class);
 1217  
     }
 1218  
 }