Skip to content

Commit 7cec210

Browse files
Use generic class names (Person, Cat, Dog) in Lombok tests
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
1 parent 43f3693 commit 7cec210

File tree

1 file changed

+30
-46
lines changed

1 file changed

+30
-46
lines changed

xapi-model-spring-boot-starter/src/test/java/dev/learning/xapi/autoconfigure/model/LombokProcessingTests.java

Lines changed: 30 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -24,89 +24,73 @@
2424
*/
2525
class LombokProcessingTests {
2626

27-
/**
28-
* Test class using Lombok @Getter and @Setter annotations. This simulates the Subscription class
29-
* mentioned in the issue.
30-
*/
27+
/** Test class using Lombok @Getter and @Setter annotations. */
3128
@Getter
3229
@Setter
33-
static class TestSubscription {
34-
private String id;
35-
private String topic;
30+
static class Person {
31+
private String name;
32+
private int age;
3633
private boolean active;
3734
}
3835

39-
/**
40-
* Test class using Lombok @Builder annotation. This simulates the SubscriptionProperties class
41-
* mentioned in the issue.
42-
*/
36+
/** Test class using Lombok @Builder annotation. */
4337
@Builder
4438
@Getter
45-
static class TestSubscriptionProperties {
46-
private String endpoint;
47-
private int maxRetries;
48-
private long timeout;
39+
static class Cat {
40+
private String name;
41+
private String breed;
42+
private int age;
4943
}
5044

5145
/** Test class using Lombok @Value annotation for immutability. */
5246
@Value
5347
@Builder
54-
static class TestImmutableSubscription {
55-
String id;
56-
String topic;
57-
boolean active;
48+
static class Dog {
49+
String name;
50+
String breed;
51+
int weight;
5852
}
5953

6054
@Test
6155
@DisplayName("When Using Getter And Setter Then Lombok Processing Works")
6256
void testGetterSetterProcessing() {
6357
// Given
64-
TestSubscription subscription = new TestSubscription();
58+
Person person = new Person();
6559

6660
// When
67-
subscription.setId("sub-123");
68-
subscription.setTopic("xapi-events");
69-
subscription.setActive(true);
61+
person.setName("John Doe");
62+
person.setAge(30);
63+
person.setActive(true);
7064

7165
// Then
72-
assertThat(subscription.getId(), is("sub-123"));
73-
assertThat(subscription.getTopic(), is("xapi-events"));
74-
assertThat(subscription.isActive(), is(true));
66+
assertThat(person.getName(), is("John Doe"));
67+
assertThat(person.getAge(), is(30));
68+
assertThat(person.isActive(), is(true));
7569
}
7670

7771
@Test
7872
@DisplayName("When Using Builder Then Lombok Processing Works")
7973
void testBuilderProcessing() {
8074
// When
81-
TestSubscriptionProperties properties =
82-
TestSubscriptionProperties.builder()
83-
.endpoint("https://example.com/webhook")
84-
.maxRetries(3)
85-
.timeout(5000L)
86-
.build();
75+
Cat cat = Cat.builder().name("Whiskers").breed("Siamese").age(3).build();
8776

8877
// Then
89-
assertThat(properties, is(notNullValue()));
90-
assertThat(properties.getEndpoint(), is("https://example.com/webhook"));
91-
assertThat(properties.getMaxRetries(), is(3));
92-
assertThat(properties.getTimeout(), is(5000L));
78+
assertThat(cat, is(notNullValue()));
79+
assertThat(cat.getName(), is("Whiskers"));
80+
assertThat(cat.getBreed(), is("Siamese"));
81+
assertThat(cat.getAge(), is(3));
9382
}
9483

9584
@Test
9685
@DisplayName("When Using Value Then Lombok Processing Works")
9786
void testValueProcessing() {
9887
// When
99-
TestImmutableSubscription subscription =
100-
TestImmutableSubscription.builder()
101-
.id("sub-456")
102-
.topic("xapi-statements")
103-
.active(false)
104-
.build();
88+
Dog dog = Dog.builder().name("Buddy").breed("Golden Retriever").weight(65).build();
10589

10690
// Then
107-
assertThat(subscription, is(notNullValue()));
108-
assertThat(subscription.getId(), is("sub-456"));
109-
assertThat(subscription.getTopic(), is("xapi-statements"));
110-
assertThat(subscription.isActive(), is(false));
91+
assertThat(dog, is(notNullValue()));
92+
assertThat(dog.getName(), is("Buddy"));
93+
assertThat(dog.getBreed(), is("Golden Retriever"));
94+
assertThat(dog.getWeight(), is(65));
11195
}
11296
}

0 commit comments

Comments
 (0)