Skip to content

Commit acb4b23

Browse files
committed
## Release Notes
- Feature: Support Enums in `@TestWithCases` #127
1 parent aa8b80d commit acb4b23

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The purpose of this project is to generate full object graphs for use in test su
1818
<dependency>
1919
<groupId>com.github.nylle</groupId>
2020
<artifactId>javafixture</artifactId>
21-
<version>2.14.0</version>
21+
<version>2.15.0</version>
2222
<scope>test</scope>
2323
</dependency>
2424
```
@@ -317,7 +317,17 @@ Due to Java's limited annotation design, the following rules apply:
317317
be of type `int` and so on.
318318
- The current implementation only supports up to 6 arguments per test method.
319319

320-
### Parameterized Tests With Random Injected Values
320+
#### Enums Are Supported
321+
```java
322+
@TestWithCases
323+
@TestCase(str1 = "VALUE1", str2 = "VALUE1")
324+
@TestCase(str1 = "VALUE2", str2 = "VALUE2")
325+
void canCreateEnumFromString(TestEnum testEnum, String string) {
326+
assertThat(testEnum).isEqualTo(TestEnum.valueOf(string));
327+
}
328+
```
329+
330+
#### Random Injected Values
321331
If you are using `@TestWithFixture` and want to make the test parameterized, you can do so by using the annotation `@Fixture` inline:
322332
```java
323333
@TestWithCases
@@ -330,4 +340,4 @@ void testStringLength(String input, @Fixture TestDto fixture) {
330340
```
331341
The test will be run for every `@TestCase`-annotation injecting the provided and the randomly generated values into the test's arguments.
332342

333-
**The random values will be identical for all test-cases!**
343+
The random values will be identical for all test-cases.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>com.github.nylle</groupId>
88
<artifactId>javafixture</artifactId>
99
<packaging>jar</packaging>
10-
<version>2.14.0</version>
10+
<version>2.15.0</version>
1111

1212
<name>JavaFixture</name>
1313
<url>https://github.com/Nylle/JavaFixture</url>

0 commit comments

Comments
 (0)