1919import io .github .mikeddavydov .jpwise .core .TestParameter ;
2020
2121/**
22- * A facade class providing a simplified API for the JPWise test generation
23- * framework. This class
24- * offers static methods for building test inputs and generating test
25- * combinations using either
22+ * A facade class providing a simplified API for the JPWise test generation framework. This class
23+ * offers static methods for building test inputs and generating test combinations using either
2624 * pairwise or combinatorial algorithms.
2725 *
28- * <p>
29- * Example usage:
26+ * <p>Example usage:
3027 *
3128 * <pre>
3229 * // Direct generation
@@ -54,8 +51,7 @@ private JPWise() {
5451 }
5552
5653 /**
57- * Creates a new InputBuilder for fluently constructing test inputs. This is an
58- * alias for {@link
54+ * Creates a new InputBuilder for fluently constructing test inputs. This is an alias for {@link
5955 * #builder()}.
6056 *
6157 * @return A new InputBuilder instance
@@ -96,8 +92,7 @@ public static InputBuilder withParameters(Collection<TestParameter> parameters)
9692 }
9793
9894 /**
99- * Generates test combinations using the pairwise algorithm with default
100- * settings.
95+ * Generates test combinations using the pairwise algorithm with default settings.
10196 *
10297 * @param parameters The test parameters
10398 * @return A table of generated test combinations
@@ -108,8 +103,7 @@ public static CombinationTable generatePairwise(TestParameter... parameters) {
108103 }
109104
110105 /**
111- * Generates test combinations using the pairwise algorithm with default
112- * settings.
106+ * Generates test combinations using the pairwise algorithm with default settings.
113107 *
114108 * @param parameters The test parameters
115109 * @return A table of generated test combinations
@@ -122,11 +116,10 @@ public static CombinationTable generatePairwise(Collection<TestParameter> parame
122116 /**
123117 * Generates test combinations using a configured pairwise algorithm.
124118 *
125- * @param algorithm The configured pairwise algorithm instance
119+ * @param algorithm The configured pairwise algorithm instance
126120 * @param parameters The test parameters
127121 * @return A table of generated test combinations
128- * @throws NullPointerException if algorithm, parameters array, or any parameter
129- * is null
122+ * @throws NullPointerException if algorithm, parameters array, or any parameter is null
130123 */
131124 public static CombinationTable generatePairwise (
132125 PairwiseAlgorithm algorithm , TestParameter ... parameters ) {
@@ -137,11 +130,10 @@ public static CombinationTable generatePairwise(
137130 /**
138131 * Generates test combinations using a configured pairwise algorithm.
139132 *
140- * @param algorithm The configured pairwise algorithm instance
133+ * @param algorithm The configured pairwise algorithm instance
141134 * @param parameters The test parameters
142135 * @return A table of generated test combinations
143- * @throws NullPointerException if algorithm, parameters collection, or any
144- * parameter is null
136+ * @throws NullPointerException if algorithm, parameters collection, or any parameter is null
145137 */
146138 public static CombinationTable generatePairwise (
147139 PairwiseAlgorithm algorithm , Collection <TestParameter > parameters ) {
@@ -150,8 +142,7 @@ public static CombinationTable generatePairwise(
150142 }
151143
152144 /**
153- * Generates test combinations using the pairwise algorithm with default
154- * settings.
145+ * Generates test combinations using the pairwise algorithm with default settings.
155146 *
156147 * @param input The test input configuration
157148 * @return A table of generated test combinations
@@ -164,7 +155,7 @@ public static CombinationTable generatePairwise(TestInput input) {
164155 /**
165156 * Generates test combinations using a configured pairwise algorithm.
166157 *
167- * @param input The test input configuration
158+ * @param input The test input configuration
168159 * @param algorithm The configured pairwise algorithm instance
169160 * @return A table of generated test combinations
170161 * @throws NullPointerException if input or algorithm is null
@@ -176,8 +167,7 @@ public static CombinationTable generatePairwise(TestInput input, PairwiseAlgorit
176167 }
177168
178169 /**
179- * Generates test combinations using the combinatorial algorithm with default
180- * settings.
170+ * Generates test combinations using the combinatorial algorithm with default settings.
181171 *
182172 * @param parameters The test parameters
183173 * @return A table of generated test combinations
@@ -188,14 +178,12 @@ public static CombinationTable generateCombinatorial(TestParameter... parameters
188178 }
189179
190180 /**
191- * Generates test combinations using the combinatorial algorithm with default
192- * settings.
181+ * Generates test combinations using the combinatorial algorithm with default settings.
193182 *
194183 * @param parameters The test parameters
195- * @param limit The maximum number of combinations to generate
184+ * @param limit The maximum number of combinations to generate
196185 * @return A table of generated test combinations
197- * @throws NullPointerException if parameters collection or any element is
198- * null
186+ * @throws NullPointerException if parameters collection or any element is null
199187 * @throws IllegalArgumentException if limit is less than 1
200188 */
201189 public static CombinationTable generateCombinatorial (
@@ -206,12 +194,11 @@ public static CombinationTable generateCombinatorial(
206194 /**
207195 * Generates test combinations using a configured combinatorial algorithm.
208196 *
209- * @param algorithm The configured combinatorial algorithm instance
210- * @param limit The maximum number of combinations to generate
197+ * @param algorithm The configured combinatorial algorithm instance
198+ * @param limit The maximum number of combinations to generate
211199 * @param parameters The test parameters
212200 * @return A table of generated test combinations
213- * @throws NullPointerException if algorithm, parameters array, or any
214- * parameter is null
201+ * @throws NullPointerException if algorithm, parameters array, or any parameter is null
215202 * @throws IllegalArgumentException if limit is less than 1
216203 */
217204 public static CombinationTable generateCombinatorial (
@@ -221,8 +208,7 @@ public static CombinationTable generateCombinatorial(
221208 }
222209
223210 /**
224- * Generates test combinations using the combinatorial algorithm with default
225- * settings.
211+ * Generates test combinations using the combinatorial algorithm with default settings.
226212 *
227213 * @param input The test input configuration
228214 * @return A table of generated test combinations
@@ -235,7 +221,7 @@ public static CombinationTable generateCombinatorial(TestInput input) {
235221 /**
236222 * Generates test combinations using a configured combinatorial algorithm.
237223 *
238- * @param input The test input configuration
224+ * @param input The test input configuration
239225 * @param algorithm The configured combinatorial algorithm instance
240226 * @return A table of generated test combinations
241227 * @throws NullPointerException if input or algorithm is null
@@ -246,14 +232,13 @@ public static CombinationTable generateCombinatorial(
246232 }
247233
248234 /**
249- * Generates test combinations using a configured combinatorial algorithm with a
250- * limit.
235+ * Generates test combinations using a configured combinatorial algorithm with a limit.
251236 *
252- * @param input The test input configuration
237+ * @param input The test input configuration
253238 * @param algorithm The configured combinatorial algorithm instance
254- * @param limit The maximum number of combinations to generate
239+ * @param limit The maximum number of combinations to generate
255240 * @return A table of generated test combinations
256- * @throws NullPointerException if input or algorithm is null
241+ * @throws NullPointerException if input or algorithm is null
257242 * @throws IllegalArgumentException if limit is less than 1
258243 */
259244 public static CombinationTable generateCombinatorial (
@@ -268,19 +253,22 @@ public static CombinationTable generateCombinatorial(
268253 }
269254
270255 private static CombinationTable executeGeneration (
271- TestInput input , GenerationAlgorithm algorithm , int nWiseOrLimit ) {
272- logger .debug ( "JPWise.executeGeneration called with algorithm: {}, nWiseOrLimit: {}" ,
273- algorithm . getClass (). getSimpleName (), nWiseOrLimit );
274- Objects . requireNonNull ( input , "input must not be null" );
275- Objects . requireNonNull ( algorithm , "algorithm must not be null" );
276- if ( nWiseOrLimit < 1 ) {
277- throw new IllegalArgumentException ( "nWiseOrLimit must generally be positive." );
278- }
279-
256+ TestInput input , GenerationAlgorithm algorithm , Integer nWiseOrLimit ) {
257+ logger .info (
258+ "Executing generation with algorithm: {} for TestInput with {} parameters. NWise/Limit: {}" ,
259+ algorithm . getClass (). getSimpleName (),
260+ input . getTestParameters (). size (),
261+ nWiseOrLimit == null ? "default" : nWiseOrLimit );
262+
263+ // Create the generator and run the algorithm.
264+ // The nWiseOrLimit is now handled by the algorithm's constructor if needed.
280265 TestGenerator generator = new TestGenerator (input );
281- logger .debug ("JPWise.executeGeneration: TestGenerator created. Calling TestGenerator.generate()..." );
282- CombinationTable result = generator .generate (algorithm , nWiseOrLimit );
283- logger .info ("Generated {} test combinations" , result .size ());
266+ logger .debug (
267+ "JPWise.executeGeneration: TestGenerator created. Calling TestGenerator.generate()..." );
268+ CombinationTable result = generator .generate (algorithm );
269+ logger .debug (
270+ "JPWise.executeGeneration: TestGenerator.generate() returned. Result size: {}" ,
271+ result .size ());
284272 return result ;
285273 }
286274
@@ -310,7 +298,7 @@ public InputBuilder parameter(TestParameter parameter) {
310298 /**
311299 * Creates and adds a parameter with the given name and partitions.
312300 *
313- * @param name The parameter name
301+ * @param name The parameter name
314302 * @param partitions The parameter's partitions
315303 * @return This builder instance
316304 * @throws NullPointerException if name or partitions array is null
@@ -322,12 +310,11 @@ public InputBuilder parameter(String name, EquivalencePartition... partitions) {
322310 }
323311
324312 /**
325- * Creates and adds a parameter with the given name, partitions, and
326- * compatibility rules.
313+ * Creates and adds a parameter with the given name, partitions, and compatibility rules.
327314 *
328- * @param name The parameter name
315+ * @param name The parameter name
329316 * @param partitions The parameter's partitions
330- * @param rules The parameter's compatibility rules
317+ * @param rules The parameter's compatibility rules
331318 * @return This builder instance
332319 * @throws NullPointerException if any argument is null
333320 */
@@ -382,8 +369,7 @@ public TestInput build() {
382369 }
383370
384371 /**
385- * Convenience method to generate test combinations using the pairwise algorithm
386- * with default
372+ * Convenience method to generate test combinations using the pairwise algorithm with default
387373 * settings.
388374 *
389375 * @return A table of generated test combinations
@@ -394,8 +380,7 @@ public CombinationTable generatePairwise() {
394380 }
395381
396382 /**
397- * Convenience method to generate test combinations using the combinatorial
398- * algorithm with
383+ * Convenience method to generate test combinations using the combinatorial algorithm with
399384 * default settings.
400385 *
401386 * @return A table of generated test combinations
@@ -405,8 +390,7 @@ public CombinationTable generateCombinatorial() {
405390 }
406391
407392 /**
408- * Convenience method to generate test combinations using the combinatorial
409- * algorithm with a
393+ * Convenience method to generate test combinations using the combinatorial algorithm with a
410394 * limit.
411395 *
412396 * @param limit The maximum number of combinations to generate
0 commit comments