View Javadoc

1   /*
2    * Copyright 2010 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  
17  package org.callbackparams.combine;
18  
19  import java.util.Collection;
20  
21  /**
22   * This is the API-interface that must be implemented by any
23   * combine-strategy class.
24   * <br/><br/>
25   * The combine-strategy class should also have a default constructor or it
26   * cannot be instanciated by the framework's built-in funtionality, which is
27   * available through the class {@link
28   * org.callbackparams.combine.annotation.AnnotationAwareCallbackRecordsFactory
29   * AnnotationAwareCallbackRecordsFactory}, which assumes the annotation
30   * {@link org.callbackparams.combine.annotation.CombineConfig @CombineConfig}
31   * has been used to specify the combine-strategy class.
32   * <br/><br/>
33   * Instead of having the strategy-classes explicitly implement this interface
34   * strategy-developers are encouraged to subclass
35   * {@link AbstractCombineStrategy}. This abstract class offers some common
36   * functionality and can also keep your test-classes up-to-date with any future
37   * modifications to this interface.
38   *
39   * @see AbstractCombineStrategy
40   *
41   * @author Henrik Kaipe
42   */
43  public interface CombineStrategy {
44  
45      /**
46       * Specifies the maximum number of combinations that the method
47       * {@link #combine(ValuesCollection)} is allowed to return. The default
48       * value is implementation dependent.
49       */
50      void setMaxCount(int maxCount);
51      
52      /**
53       * Some CombineStrategy implementations does to some extent pick
54       * callback-record parameters randomly. With this setter it is possible to
55       * specify which random seed to use and therewith make sure the exact same
56       * set of callback-records is used on each test-run.
57       */
58      void setRandomSeed(long randomSeed);
59      
60      /**
61       * Implementations of this method will create a collection of callback-
62       * records based on the configuration of this CombineStrategy instance.
63       * The callback-parameters used at a certain index in the created
64       * callback-records are picked from the array at the corresponding index
65       * in the argument ValuesCollection instance.
66       */
67      Collection combine(ValuesCollection vc);
68  }