Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/extensions/autoparams-kotlin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For Maven, you can add the following dependency to your `pom.xml`:
<dependency>
<groupId>io.github.autoparams</groupId>
<artifactId>autoparams-kotlin</artifactId>
<version>11.0.0</version>
<version>11.0.1</version>
</dependency>
```

Expand All @@ -27,15 +27,15 @@ For Maven, you can add the following dependency to your `pom.xml`:
For Gradle Groovy DSL, use:

```gradle
testImplementation 'io.github.autoparams:autoparams-kotlin:11.0.0'
testImplementation 'io.github.autoparams:autoparams-kotlin:11.0.1'
```

### Gradle (Kotlin)

For Gradle Kotlin DSL, use:

```gradle
testImplementation("io.github.autoparams:autoparams-kotlin:11.0.0")
testImplementation("io.github.autoparams:autoparams-kotlin:11.0.1")
```

## `@AutoKotlinParams` Annotation
Expand Down
6 changes: 3 additions & 3 deletions docs/extensions/autoparams-lombok.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For Maven, you can add the following dependency to your `pom.xml`:
<dependency>
<groupId>io.github.autoparams</groupId>
<artifactId>autoparams-lombok</artifactId>
<version>11.0.0</version>
<version>11.0.1</version>
</dependency>
```

Expand All @@ -27,15 +27,15 @@ For Maven, you can add the following dependency to your `pom.xml`:
For Gradle Groovy DSL, use:

```gradle
testImplementation 'io.github.autoparams:autoparams-lombok:11.0.0'
testImplementation 'io.github.autoparams:autoparams-lombok:11.0.1'
```

### Gradle (Kotlin)

For Gradle Kotlin DSL, use:

```gradle
testImplementation("io.github.autoparams:autoparams-lombok:11.0.0")
testImplementation("io.github.autoparams:autoparams-lombok:11.0.1")
```

## `BuilderCustomizer` Class
Expand Down
6 changes: 3 additions & 3 deletions docs/extensions/autoparams-mockito.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For Maven, you can add the following dependency to your `pom.xml`:
<dependency>
<groupId>io.github.autoparams</groupId>
<artifactId>autoparams-mockito</artifactId>
<version>11.0.0</version>
<version>11.0.1</version>
</dependency>
```

Expand All @@ -27,15 +27,15 @@ For Maven, you can add the following dependency to your `pom.xml`:
For Gradle Groovy DSL, use:

```gradle
testImplementation 'io.github.autoparams:autoparams-mockito:11.0.0'
testImplementation 'io.github.autoparams:autoparams-mockito:11.0.1'
```

### Gradle (Kotlin)

For Gradle Kotlin DSL, use:

```gradle
testImplementation("io.github.autoparams:autoparams-mockito:11.0.0")
testImplementation("io.github.autoparams:autoparams-mockito:11.0.1")
```

## Generating Test Doubles with Mockito
Expand Down
8 changes: 4 additions & 4 deletions docs/extensions/autoparams-spring.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ For Maven, you can add the following dependency to your pom.xml:
<dependency>
<groupId>io.github.autoparams</groupId>
<artifactId>autoparams-spring</artifactId>
<version>11.0.0</version>
<version>11.0.1</version>
</dependency>
```

Expand All @@ -35,15 +35,15 @@ For Maven, you can add the following dependency to your pom.xml:
For Gradle Groovy, use:

```gradle
testImplementation 'io.github.autoparams:autoparams-spring:11.0.0'
testImplementation 'io.github.autoparams:autoparams-spring:11.0.1'
```

### Gradle (Kotlin)

For Gradle Kotlin, use:

```gradle
testImplementation("io.github.autoparams:autoparams-spring:11.0.0")
testImplementation("io.github.autoparams:autoparams-spring:11.0.1")
```

## `@UseBeans` Annotation
Expand Down Expand Up @@ -89,7 +89,7 @@ class HelloSupplier : MessageSupplier {
```
</JavaKotlinCodeBlock>

If you want to test how your `MessageSupplier` bean behaves, you can use the `@UseBeans` annotation like this:
If you want to test how your `MessageSupplier` bean behaves, you can use the [`@UseBeans`](https://javadoc.io/doc/io.github.autoparams/autoparams-spring/latest/autoparams/spring/UseBeans.html) annotation like this:

<JavaKotlinCodeBlock>
```java
Expand Down
14 changes: 7 additions & 7 deletions docs/features/customization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ For example, suppose the `Product` entity must follow these business rules:
- `priceAmount` must be greater than or equal to `10`
- `priceAmount` must be less than or equal to `10000`

You can implement these rules using a custom generator by extending [`ObjectGeneratorBase<T>`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/generator/ObjectGeneratorBase.html):
You can implement these rules using a custom generator by extending [`ObjectGeneratorBase<T>`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/generator/ObjectGeneratorBase.html):

<JavaKotlinCodeBlock>
```java
Expand Down Expand Up @@ -49,9 +49,9 @@ class ProductGenerator : ObjectGeneratorBase<Product>() {
```
</JavaKotlinCodeBlock>

This custom generator creates a `Product` instance that adheres to the business constraints. It uses [`ResolutionContext`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/ResolutionContext.html) to generate supporting values like `id` and `name`, and applies explicit logic to generate a valid `priceAmount`.
This custom generator creates a `Product` instance that adheres to the business constraints. It uses [`ResolutionContext`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/ResolutionContext.html) to generate supporting values like `id` and `name`, and applies explicit logic to generate a valid `priceAmount`.

You can apply this custom generator using the [`@Customization`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/customization/Customization.html) annotation:
You can apply this custom generator using the [`@Customization`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/customization/Customization.html) annotation:

<JavaKotlinCodeBlock>
```java
Expand Down Expand Up @@ -142,7 +142,7 @@ fun testMethod(product: Product, review: Review) {
```
</JavaKotlinCodeBlock>

Alternatively, if you prefer to encapsulate multiple generators into a single reusable configuration, you can extend [`CompositeCustomizer`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/customization/CompositeCustomizer.html):
Alternatively, if you prefer to encapsulate multiple generators into a single reusable configuration, you can extend [`CompositeCustomizer`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/customization/CompositeCustomizer.html):

<JavaKotlinCodeBlock>
```java
Expand Down Expand Up @@ -312,7 +312,7 @@ class TestClass {
```
</JavaKotlinCodeBlock>

In this example, we use the [`set`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/customization/dsl/ArgumentCustomizationDsl.html#set(autoparams.customization.dsl.FunctionDelegate)) static method from the [`ArgumentCustomizationDsl`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/customization/dsl/ArgumentCustomizationDsl.html) class to customize the behavior of the `ResolutionContext`. Specifically:
In this example, we use the [`set`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/customization/dsl/ArgumentCustomizationDsl.html#set(autoparams.customization.dsl.FunctionDelegate)) static method from the [`ArgumentCustomizationDsl`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/customization/dsl/ArgumentCustomizationDsl.html) class to customize the behavior of the `ResolutionContext`. Specifically:

- The `product` property in any `Review` instance created by the context will be set to the `product` parameter of the test.
- Likewise, the `rating` property will be set to the `rating` parameter.
Expand Down Expand Up @@ -359,7 +359,7 @@ class TestClass {
```
</JavaKotlinCodeBlock>

The [`Factory<T>`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/generator/Factory.html) class provides a convenient way to create customized objects when working with a single type. It avoids managing an explicit resolution context and keeps the test focused on the instances under test.
The [`Factory<T>`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/generator/Factory.html) class provides a convenient way to create customized objects when working with a single type. It avoids managing an explicit resolution context and keeps the test focused on the instances under test.

:::note

Expand All @@ -376,7 +376,7 @@ The `set` method relies on the availability of parameter names at runtime. Howev

## Settable Properties

If a class follows the JavaBeans convention—meaning it has a no-arguments constructor and public setter methods—AutoParams can automatically populate its properties using the [`InstancePropertyWriter`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/processor/InstancePropertyWriter.html) customizer.
If a class follows the JavaBeans convention—meaning it has a no-arguments constructor and public setter methods—AutoParams can automatically populate its properties using the [`InstancePropertyWriter`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/processor/InstancePropertyWriter.html) customizer.

Here's a simple example:

Expand Down
4 changes: 2 additions & 2 deletions docs/features/factory.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { JavaKotlinCodeBlock } from '@site/src/components/JavaKotlinCodeBlock';

# `Factory<T>` class

The [`Factory<T>`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/generator/Factory.html) class is useful when you need to generate multiple instances of the same type. It allows you to create single instances or collections of generated objects on demand.
The [`Factory<T>`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/generator/Factory.html) class is useful when you need to generate multiple instances of the same type. It allows you to create single instances or collections of generated objects on demand.

Here's an example:

Expand All @@ -31,4 +31,4 @@ fun testMethod() {
```
</JavaKotlinCodeBlock>

In this example, a `Factory<Product>` is created to produce `Product` instances. The [`get()`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/generator/Factory.html#get()) method creates a single instance, while [`getRange(n)`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/generator/Factory.html#getRange(int,autoparams.customization.Customizer...)) returns a list of `n` instances. This approach is particularly helpful when you need bulk data generation in your tests.
In this example, a `Factory<Product>` is created to produce `Product` instances. The [`get()`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/generator/Factory.html#get()) method creates a single instance, while [`getRange(n)`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/generator/Factory.html#getRange(int,autoparams.customization.Customizer...)) returns a list of `n` instances. This approach is particularly helpful when you need bulk data generation in your tests.
10 changes: 5 additions & 5 deletions docs/features/freeze-by.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { JavaKotlinCodeBlock } from '@site/src/components/JavaKotlinCodeBlock';

# `@FreezeBy` Annotation

The [`@FreezeBy`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/customization/FreezeBy.html) annotation enables fine-grained control over value freezing in tests. It allows you to freeze a single value and reuse it across multiple generation targets that match specific conditions, such as type or name. This helps improve test readability and ensures consistency among generated values.
The [`@FreezeBy`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/customization/FreezeBy.html) annotation enables fine-grained control over value freezing in tests. It allows you to freeze a single value and reuse it across multiple generation targets that match specific conditions, such as type or name. This helps improve test readability and ensures consistency among generated values.

## Matching Strategies

AutoParams provides several matching strategies that determine which targets should receive the frozen value during object generation. The following examples illustrate some strategies:

- [`EXACT_TYPE`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/customization/Matching.html#EXACT_TYPE)
- [`EXACT_TYPE`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/customization/Matching.html#EXACT_TYPE)

Reuses the frozen value for all targets with the exact same type.

Expand Down Expand Up @@ -72,7 +72,7 @@ AutoParams provides several matching strategies that determine which targets sho

In this example, all `String` targets—including the `String` field inside `StringContainer`—are generated with the same frozen value.

- [`IMPLEMENTED_INTERFACES`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/customization/Matching.html#IMPLEMENTED_INTERFACES)
- [`IMPLEMENTED_INTERFACES`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/customization/Matching.html#IMPLEMENTED_INTERFACES)

Reuses the frozen value for targets whose types are interfaces that the frozen value's type implements.

Expand Down Expand Up @@ -116,7 +116,7 @@ AutoParams provides several matching strategies that determine which targets sho

In this example, `String` implements `CharSequence`, so the same value is reused for both `s1` and `chars`. `StringContainer` is not affected because its type is not an interface.

- [`PARAMETER_NAME`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/customization/Matching.html#PARAMETER_NAME)
- [`PARAMETER_NAME`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/customization/Matching.html#PARAMETER_NAME)

Reuses the frozen value for other targets with matching names.

Expand Down Expand Up @@ -210,7 +210,7 @@ In this example, the frozen value `s1` is reused for both `s2` (same type) and `

## Shorthand for `EXACT_TYPE`

Using [`@Freeze`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/customization/Freeze.html) is equivalent to `@FreezeBy(EXACT_TYPE)`. It's a convenient shorthand for the most common matching strategy.
Using [`@Freeze`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/customization/Freeze.html) is equivalent to `@FreezeBy(EXACT_TYPE)`. It's a convenient shorthand for the most common matching strategy.

<JavaKotlinCodeBlock>
```java
Expand Down
10 changes: 5 additions & 5 deletions docs/features/parameterized.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Here are some of the features you can use for parameterized tests.

## `@ValueAutoSource` Annotation

The [`@ValueAutoSource`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/ValueAutoSource.html)(or `@ValueAutoKotlinSource`) annotation is a simple yet powerful tool for writing parameterized tests with AutoParams.
The [`@ValueAutoSource`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/ValueAutoSource.html)(or `@ValueAutoKotlinSource`) annotation is a simple yet powerful tool for writing parameterized tests with AutoParams.

<JavaKotlinCodeBlock>
```java
Expand Down Expand Up @@ -45,7 +45,7 @@ This feature depends on parameter name availability. See the note in the [One-ti

:::

In this example, the test method is executed twice—once with `"Camera"` and once with `"Candle"` as the value of the `name` parameter. The `factory` parameter is resolved automatically by AutoParams and can be customized using the DSL, as shown with [`freezeArgument`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/customization/dsl/ArgumentCustomizationDsl.html).
In this example, the test method is executed twice—once with `"Camera"` and once with `"Candle"` as the value of the `name` parameter. The `factory` parameter is resolved automatically by AutoParams and can be customized using the DSL, as shown with [`freezeArgument`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/customization/dsl/ArgumentCustomizationDsl.html).

This enables the creation of test objects (`Product` in this case) that are partially controlled (e.g., a fixed name) and partially randomized (e.g., all other properties), striking a balance between specificity and variety.

Expand All @@ -64,7 +64,7 @@ The usage of `@ValueAutoSource` is similar to JUnit 5's `@ValueSource`, and it s

## `@CsvAutoSource` Annotation

The [`@CsvAutoSource`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/CsvAutoSource.html)(or `@CsvAutoKotlinSource`) annotation lets you define repeated test inputs in CSV format, similar to JUnit 5’s @CsvSource. Any parameters not explicitly provided in the CSV rows will be automatically generated by AutoParams.
The [`@CsvAutoSource`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/CsvAutoSource.html)(or `@CsvAutoKotlinSource`) annotation lets you define repeated test inputs in CSV format, similar to JUnit 5’s @CsvSource. Any parameters not explicitly provided in the CSV rows will be automatically generated by AutoParams.

<JavaKotlinCodeBlock>
```java
Expand Down Expand Up @@ -100,7 +100,7 @@ This approach makes it easy to test combinations of fixed and dynamic values in

## `@MethodAutoSource` Annotation

The [`@MethodAutoSource`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/MethodAutoSource.html)(or `@MethodAutoKotlinSource`) annotation combines the features of JUnit 5’s `@MethodSource` and AutoParams’s `@AutoSource`. You can specify a method that provides test data, and AutoParams will fill in any remaining parameters automatically.
The [`@MethodAutoSource`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/MethodAutoSource.html)(or `@MethodAutoKotlinSource`) annotation combines the features of JUnit 5’s `@MethodSource` and AutoParams’s `@AutoSource`. You can specify a method that provides test data, and AutoParams will fill in any remaining parameters automatically.

<JavaKotlinCodeBlock>
```java
Expand Down Expand Up @@ -145,7 +145,7 @@ This setup allows you to blend manually specified values with automatically gene

## `@Repeat` Annotation

The [`@Repeat`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/Repeat.html) annotation allows you to run a test multiple times, generating fresh random values for unspecified parameters on each run.
The [`@Repeat`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/Repeat.html) annotation allows you to run a test multiple times, generating fresh random values for unspecified parameters on each run.

<JavaKotlinCodeBlock>
```java
Expand Down
2 changes: 1 addition & 1 deletion docs/features/resolution-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { JavaKotlinCodeBlock } from '@site/src/components/JavaKotlinCodeBlock';

# `ResolutionContext` class

The [`ResolutionContext`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.0/autoparams/ResolutionContext.html) class provides the core mechanism for generating test data. While it is used internally by AutoParams, you can also instantiate and use it directly in your own test code when needed.
The [`ResolutionContext`](https://www.javadoc.io/static/io.github.autoparams/autoparams/11.0.1/autoparams/ResolutionContext.html) class provides the core mechanism for generating test data. While it is used internally by AutoParams, you can also instantiate and use it directly in your own test code when needed.

Here's an example:

Expand Down
6 changes: 3 additions & 3 deletions docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ For Maven, you can add the following dependency to your `pom.xml`:
<dependency>
<groupId>io.github.autoparams</groupId>
<artifactId>autoparams</artifactId>
<version>11.0.0</version>
<version>11.0.1</version>
</dependency>
```

Expand All @@ -29,13 +29,13 @@ For Maven, you can add the following dependency to your `pom.xml`:
For Gradle Groovy DSL, use:

```gradle
testImplementation 'io.github.autoparams:autoparams:11.0.0'
testImplementation 'io.github.autoparams:autoparams:11.0.1'
```

### Gradle (Kotlin)

For Gradle Kotlin DSL, use:

```gradle
testImplementation("io.github.autoparams:autoparams:11.0.0")
testImplementation("io.github.autoparams:autoparams:11.0.1")
```
Loading