Skip to content

Commit f06b07c

Browse files
committed
test: Use enums with fields in test
1 parent b27151a commit f06b07c

File tree

15 files changed

+90
-42
lines changed

15 files changed

+90
-42
lines changed

springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/components/DefaultJsonComponentsServiceIntegrationTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import lombok.Data;
2727
import lombok.Getter;
2828
import lombok.NoArgsConstructor;
29+
import lombok.RequiredArgsConstructor;
2930
import lombok.Setter;
3031
import org.junit.jupiter.api.Nested;
3132
import org.junit.jupiter.api.Test;
@@ -179,9 +180,12 @@ private static class FooWithEnum {
179180
private String s;
180181
private Bar b;
181182

183+
@RequiredArgsConstructor
182184
private enum Bar {
183-
BAR1,
184-
BAR2
185+
BAR1(1),
186+
BAR2(2);
187+
188+
private final int code;
185189
}
186190
}
187191

springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/components/DefaultXmlComponentsServiceIntegrationTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import jakarta.xml.bind.annotation.XmlRootElement;
2525
import lombok.Data;
2626
import lombok.NoArgsConstructor;
27+
import lombok.RequiredArgsConstructor;
2728
import org.junit.jupiter.api.Nested;
2829
import org.junit.jupiter.api.Test;
2930

@@ -191,9 +192,12 @@ private static class FooWithEnum {
191192
private String s;
192193
private Bar b;
193194

195+
@RequiredArgsConstructor
194196
private enum Bar {
195-
BAR1,
196-
BAR2
197+
BAR1(1),
198+
BAR2(2);
199+
200+
private final int code;
197201
}
198202
}
199203

springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/components/DefaultYamlComponentsServiceIntegrationTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import lombok.Data;
2929
import lombok.Getter;
3030
import lombok.NoArgsConstructor;
31+
import lombok.RequiredArgsConstructor;
3132
import lombok.Setter;
3233
import org.junit.jupiter.api.Nested;
3334
import org.junit.jupiter.api.Test;
@@ -185,9 +186,12 @@ private static class FooWithEnum {
185186
private String s;
186187
private Bar b;
187188

189+
@RequiredArgsConstructor
188190
private enum Bar {
189-
BAR1,
190-
BAR2
191+
BAR1(1),
192+
BAR2(2);
193+
194+
private final int code;
191195
}
192196
}
193197

springwolf-examples/springwolf-amqp-example/src/main/java/io/github/springwolf/examples/amqp/dtos/ExamplePayloadDto.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import lombok.AllArgsConstructor;
66
import lombok.Data;
77
import lombok.NoArgsConstructor;
8+
import lombok.RequiredArgsConstructor;
89

910
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
1011

@@ -22,9 +23,12 @@ public class ExamplePayloadDto {
2223
@Schema(description = "Some enum field", example = "FOO2", requiredMode = REQUIRED)
2324
private ExampleEnum someEnum;
2425

26+
@RequiredArgsConstructor
2527
public enum ExampleEnum {
26-
FOO1,
27-
FOO2,
28-
FOO3
28+
FOO1(1),
29+
FOO2(2),
30+
FOO3(3);
31+
32+
private final int code;
2933
}
3034
}

springwolf-examples/springwolf-cloud-stream-example/src/main/java/io/github/springwolf/examples/cloudstream/dtos/ExamplePayloadDto.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import lombok.AllArgsConstructor;
66
import lombok.Data;
77
import lombok.NoArgsConstructor;
8+
import lombok.RequiredArgsConstructor;
89

910
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
1011

@@ -22,9 +23,12 @@ public class ExamplePayloadDto {
2223
@Schema(description = "Some enum field", example = "FOO2", requiredMode = REQUIRED)
2324
private ExampleEnum someEnum;
2425

26+
@RequiredArgsConstructor
2527
public enum ExampleEnum {
26-
FOO1,
27-
FOO2,
28-
FOO3
28+
FOO1(1),
29+
FOO2(2),
30+
FOO3(3);
31+
32+
private final int code;
2933
}
3034
}

springwolf-examples/springwolf-jms-example/src/main/java/io/github/springwolf/examples/jms/dtos/ExamplePayloadDto.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import lombok.AllArgsConstructor;
66
import lombok.Data;
77
import lombok.NoArgsConstructor;
8+
import lombok.RequiredArgsConstructor;
89

910
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
1011

@@ -22,9 +23,12 @@ public class ExamplePayloadDto {
2223
@Schema(description = "Some enum field", example = "FOO2", requiredMode = REQUIRED)
2324
private ExampleEnum someEnum;
2425

26+
@RequiredArgsConstructor
2527
public enum ExampleEnum {
26-
FOO1,
27-
FOO2,
28-
FOO3
28+
FOO1(1),
29+
FOO2(2),
30+
FOO3(3);
31+
32+
private final int code;
2933
}
3034
}

springwolf-examples/springwolf-kafka-example/src/main/java/io/github/springwolf/examples/kafka/dtos/ExamplePayloadDto.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import lombok.AllArgsConstructor;
66
import lombok.Data;
77
import lombok.NoArgsConstructor;
8+
import lombok.RequiredArgsConstructor;
89

910
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
1011

@@ -44,9 +45,12 @@ public class ExamplePayloadDto {
4445
@Schema(description = "Some enum field", example = "FOO2", requiredMode = REQUIRED)
4546
private ExampleEnum someEnum;
4647

48+
@RequiredArgsConstructor
4749
public enum ExampleEnum {
48-
FOO1,
49-
FOO2,
50-
FOO3
50+
FOO1(1),
51+
FOO2(2),
52+
FOO3(3);
53+
54+
private final int code;
5155
}
5256
}

springwolf-examples/springwolf-kafka-example/src/main/java/io/github/springwolf/examples/kafka/dtos/XmlPayloadDto.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import lombok.AllArgsConstructor;
66
import lombok.Data;
77
import lombok.NoArgsConstructor;
8+
import lombok.RequiredArgsConstructor;
89

910
@Data
1011
@AllArgsConstructor
@@ -20,9 +21,12 @@ public class XmlPayloadDto {
2021

2122
private ExampleEnum someEnum;
2223

24+
@RequiredArgsConstructor
2325
public enum ExampleEnum {
24-
FOO1,
25-
FOO2,
26-
FOO3
26+
FOO1(1),
27+
FOO2(2),
28+
FOO3(3);
29+
30+
private final int code;
2731
}
2832
}

springwolf-examples/springwolf-kafka-example/src/main/java/io/github/springwolf/examples/kafka/dtos/YamlPayloadDto.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import lombok.AllArgsConstructor;
55
import lombok.Data;
66
import lombok.NoArgsConstructor;
7+
import lombok.RequiredArgsConstructor;
78

89
@Data
910
@AllArgsConstructor
@@ -16,9 +17,12 @@ public class YamlPayloadDto {
1617

1718
private ExampleEnum someEnum;
1819

20+
@RequiredArgsConstructor
1921
public enum ExampleEnum {
20-
FOO1,
21-
FOO2,
22-
FOO3
22+
FOO1(1),
23+
FOO2(2),
24+
FOO3(3);
25+
26+
private final int code;
2327
}
2428
}

springwolf-examples/springwolf-kafka-example/src/test/resources/asyncapi.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@
443443
"type": "object"
444444
}
445445
},
446-
"SpringKafkaDefaultHeaders-ExamplePayloadDto-1316119953": {
447-
"title": "SpringKafkaDefaultHeaders-ExamplePayloadDto-1316119953",
446+
"SpringKafkaDefaultHeaders-ExamplePayloadDto-1059949590": {
447+
"title": "SpringKafkaDefaultHeaders-ExamplePayloadDto-1059949590",
448448
"type": "object",
449449
"properties": {
450450
"__TypeId__": {
@@ -494,7 +494,7 @@
494494
"type": "string"
495495
}
496496
},
497-
"title": "SpringKafkaDefaultHeaders-ExamplePayloadDto-1316119953",
497+
"title": "SpringKafkaDefaultHeaders-ExamplePayloadDto-1059949590",
498498
"type": "object"
499499
}
500500
},
@@ -1579,7 +1579,7 @@
15791579
},
15801580
"io.github.springwolf.examples.kafka.dtos.ExamplePayloadDto": {
15811581
"headers": {
1582-
"$ref": "#/components/schemas/SpringKafkaDefaultHeaders-ExamplePayloadDto-1316119953"
1582+
"$ref": "#/components/schemas/SpringKafkaDefaultHeaders-ExamplePayloadDto-1059949590"
15831583
},
15841584
"payload": {
15851585
"schemaFormat": "application/vnd.aai.asyncapi+json;version=3.0.0",

0 commit comments

Comments
 (0)