Skip to content

Commit b1d6d7e

Browse files
committed
junit parameterized tests - enum source
1 parent bdce87f commit b1d6d7e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package guru.springframework.sfgpetclinic.model;
2+
3+
public enum OwnerType {
4+
INDIVIDUAL, COMPANY
5+
}

src/test/java/guru/springframework/sfgpetclinic/model/OwnerTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.junit.jupiter.api.Tag;
66
import org.junit.jupiter.api.Test;
77
import org.junit.jupiter.params.ParameterizedTest;
8+
import org.junit.jupiter.params.provider.EnumSource;
89
import org.junit.jupiter.params.provider.ValueSource;
910

1011
import static org.junit.jupiter.api.Assertions.*;
@@ -34,4 +35,10 @@ void testValueSource(String val){
3435
System.out.println(val);
3536
}
3637

38+
@DisplayName("value source test - ")
39+
@ParameterizedTest(name = "{displayName} [{index}] {argumentsWithNames}")
40+
@EnumSource(OwnerType.class)
41+
void enumTest(OwnerType ownerType){
42+
System.out.println(ownerType);
43+
}
3744
}

0 commit comments

Comments
 (0)