Skip to content

Commit aa6319c

Browse files
committed
Simplified test class names
1 parent 20a7173 commit aa6319c

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlGeneratorEmbeddedUnitTests.java

+41-41
Original file line numberDiff line numberDiff line change
@@ -89,92 +89,92 @@ void findOne() {
8989
@Test // GH-574
9090
void findOneWrappedId() {
9191

92-
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntityWithWrappedId.class);
92+
SqlGenerator sqlGenerator = createSqlGenerator(WithWrappedId.class);
9393

9494
String sql = sqlGenerator.getFindOne();
9595

9696
assertSoftly(softly -> {
9797

9898
softly.assertThat(sql).startsWith("SELECT") //
99-
.contains("dummy_entity_with_wrapped_id.name AS name") //
100-
.contains("dummy_entity_with_wrapped_id.id") //
101-
.contains("WHERE dummy_entity_with_wrapped_id.id = :id");
99+
.contains("with_wrapped_id.name AS name") //
100+
.contains("with_wrapped_id.id") //
101+
.contains("WHERE with_wrapped_id.id = :id");
102102
});
103103
}
104104

105105
@Test // GH-574
106106
void findOneEmbeddedId() {
107107

108-
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntityWithEmbeddedId.class);
108+
SqlGenerator sqlGenerator = createSqlGenerator(WithEmbeddedId.class);
109109

110110
String sql = sqlGenerator.getFindOne();
111111

112112
assertSoftly(softly -> {
113113

114114
softly.assertThat(sql).startsWith("SELECT") //
115-
.contains("dummy_entity_with_embedded_id.name AS name") //
116-
.contains("dummy_entity_with_embedded_id.one") //
117-
.contains("dummy_entity_with_embedded_id.two") //
115+
.contains("with_embedded_id.name AS name") //
116+
.contains("with_embedded_id.one") //
117+
.contains("with_embedded_id.two") //
118118
.contains(" WHERE ") //
119-
.contains("dummy_entity_with_embedded_id.one = :one") //
120-
.contains("dummy_entity_with_embedded_id.two = :two");
119+
.contains("with_embedded_id.one = :one") //
120+
.contains("with_embedded_id.two = :two");
121121
});
122122
}
123123

124124
@Test // GH-574
125125
void deleteByIdEmbeddedId() {
126126

127-
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntityWithEmbeddedId.class);
127+
SqlGenerator sqlGenerator = createSqlGenerator(WithEmbeddedId.class);
128128

129129
String sql = sqlGenerator.getDeleteById();
130130

131131
assertSoftly(softly -> {
132132

133133
softly.assertThat(sql).startsWith("DELETE") //
134134
.contains(" WHERE ") //
135-
.contains("dummy_entity_with_embedded_id.one = :one") //
136-
.contains("dummy_entity_with_embedded_id.two = :two");
135+
.contains("with_embedded_id.one = :one") //
136+
.contains("with_embedded_id.two = :two");
137137
});
138138
}
139139

140140
@Test // GH-574
141141
void deleteByIdInEmbeddedId() {
142142

143-
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntityWithEmbeddedId.class);
143+
SqlGenerator sqlGenerator = createSqlGenerator(WithEmbeddedId.class);
144144

145145
String sql = sqlGenerator.getDeleteByIdIn();
146146

147147
assertSoftly(softly -> {
148148

149149
softly.assertThat(sql).startsWith("DELETE") //
150150
.contains(" WHERE ") //
151-
.contains("(dummy_entity_with_embedded_id.one, dummy_entity_with_embedded_id.two) IN (:ids)");
151+
.contains("(with_embedded_id.one, with_embedded_id.two) IN (:ids)");
152152
});
153153
}
154154

155155
@Test // GH-574
156156
void deleteByPathEmbeddedId() {
157157

158-
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntityWithEmbeddedId.class);
158+
SqlGenerator sqlGenerator = createSqlGenerator(WithEmbeddedId.class);
159159
PersistentPropertyPath<RelationalPersistentProperty> path = PersistentPropertyPathTestUtils.getPath("other",
160-
DummyEntityWithEmbeddedIdAndReference.class, context);
160+
WithEmbeddedIdAndReference.class, context);
161161

162162
String sql = sqlGenerator.createDeleteByPath(path);
163163

164164
assertSoftly(softly -> {
165165

166166
softly.assertThat(sql).startsWith("DELETE FROM other_entity WHERE") //
167-
.contains("other_entity.dummy_entity_with_embedded_id_and_reference_one = :one") //
168-
.contains("other_entity.dummy_entity_with_embedded_id_and_reference_two = :two");
167+
.contains("other_entity.with_embedded_id_and_reference_one = :one") //
168+
.contains("other_entity.with_embedded_id_and_reference_two = :two");
169169
});
170170
}
171171

172172
@Test // GH-574
173173
void deleteInByPathEmbeddedId() {
174174

175-
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntityWithEmbeddedId.class);
175+
SqlGenerator sqlGenerator = createSqlGenerator(WithEmbeddedId.class);
176176
PersistentPropertyPath<RelationalPersistentProperty> path = PersistentPropertyPathTestUtils.getPath("other",
177-
DummyEntityWithEmbeddedIdAndReference.class, context);
177+
WithEmbeddedIdAndReference.class, context);
178178

179179
String sql = sqlGenerator.createDeleteInByPath(path);
180180

@@ -183,39 +183,39 @@ void deleteInByPathEmbeddedId() {
183183
softly.assertThat(sql).startsWith("DELETE FROM other_entity WHERE") //
184184
.contains(" WHERE ") //
185185
.contains(
186-
"(other_entity.dummy_entity_with_embedded_id_and_reference_one, other_entity.dummy_entity_with_embedded_id_and_reference_two) IN (:ids)");
186+
"(other_entity.with_embedded_id_and_reference_one, other_entity.with_embedded_id_and_reference_two) IN (:ids)");
187187
});
188188
}
189189

190190
@Test // GH-574
191191
void updateWithEmbeddedId() {
192192

193-
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntityWithEmbeddedId.class);
193+
SqlGenerator sqlGenerator = createSqlGenerator(WithEmbeddedId.class);
194194

195195
String sql = sqlGenerator.getUpdate();
196196

197197
assertSoftly(softly -> {
198198

199199
softly.assertThat(sql).startsWith("UPDATE") //
200200
.contains(" WHERE ") //
201-
.contains("dummy_entity_with_embedded_id.one = :one") //
202-
.contains("dummy_entity_with_embedded_id.two = :two");
201+
.contains("with_embedded_id.one = :one") //
202+
.contains("with_embedded_id.two = :two");
203203
});
204204
}
205205

206206
@Test // GH-574
207207
void existsByIdEmbeddedId() {
208208

209-
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntityWithEmbeddedId.class);
209+
SqlGenerator sqlGenerator = createSqlGenerator(WithEmbeddedId.class);
210210

211211
String sql = sqlGenerator.getExists();
212212

213213
assertSoftly(softly -> {
214214

215215
softly.assertThat(sql).startsWith("SELECT COUNT") //
216216
.contains(" WHERE ") //
217-
.contains("dummy_entity_with_embedded_id.one = :one") //
218-
.contains("dummy_entity_with_embedded_id.two = :two");
217+
.contains("with_embedded_id.one = :one") //
218+
.contains("with_embedded_id.two = :two");
219219
});
220220
}
221221

@@ -269,24 +269,24 @@ void findAllInList() {
269269
@Test // GH-574
270270
void findAllInListEmbeddedId() {
271271

272-
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntityWithEmbeddedId.class);
272+
SqlGenerator sqlGenerator = createSqlGenerator(WithEmbeddedId.class);
273273

274274
String sql = sqlGenerator.getFindAllInList();
275275

276276
assertSoftly(softly -> {
277277

278278
softly.assertThat(sql).startsWith("SELECT") //
279-
.contains("dummy_entity_with_embedded_id.name AS name") //
280-
.contains("dummy_entity_with_embedded_id.one") //
281-
.contains("dummy_entity_with_embedded_id.two") //
282-
.contains(" WHERE (dummy_entity_with_embedded_id.one, dummy_entity_with_embedded_id.two) IN (:ids)");
279+
.contains("with_embedded_id.name AS name") //
280+
.contains("with_embedded_id.one") //
281+
.contains("with_embedded_id.two") //
282+
.contains(" WHERE (with_embedded_id.one, with_embedded_id.two) IN (:ids)");
283283
});
284284
}
285285

286286
@Test // GH-574
287287
void findOneWithReference() {
288288

289-
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntityWithEmbeddedIdAndReference.class);
289+
SqlGenerator sqlGenerator = createSqlGenerator(WithEmbeddedIdAndReference.class);
290290

291291
String sql = sqlGenerator.getFindOne();
292292

@@ -296,12 +296,12 @@ void findOneWithReference() {
296296
.contains(" LEFT OUTER JOIN other_entity other ") //
297297
.contains(" ON ") //
298298
.contains(
299-
" other.dummy_entity_with_embedded_id_and_reference_one = dummy_entity_with_embedded_id_and_reference.one ") //
299+
" other.with_embedded_id_and_reference_one = with_embedded_id_and_reference.one ") //
300300
.contains(
301-
" other.dummy_entity_with_embedded_id_and_reference_two = dummy_entity_with_embedded_id_and_reference.two ") //
301+
" other.with_embedded_id_and_reference_two = with_embedded_id_and_reference.two ") //
302302
.contains(" WHERE ") //
303-
.contains("dummy_entity_with_embedded_id_and_reference.one = :one") //
304-
.contains("dummy_entity_with_embedded_id_and_reference.two = :two");
303+
.contains("with_embedded_id_and_reference.one = :one") //
304+
.contains("with_embedded_id_and_reference.two = :two");
305305
});
306306
}
307307

@@ -502,7 +502,7 @@ static class DummyEntity {
502502
record WrappedId(Long id) {
503503
}
504504

505-
static class DummyEntityWithWrappedId {
505+
static class WithWrappedId {
506506

507507
@Id
508508
@Embedded(onEmpty = OnEmpty.USE_NULL) WrappedId wrappedId;
@@ -513,7 +513,7 @@ static class DummyEntityWithWrappedId {
513513
record EmbeddedId(Long one, String two) {
514514
}
515515

516-
static class DummyEntityWithEmbeddedId {
516+
static class WithEmbeddedId {
517517

518518
@Id
519519
@Embedded(onEmpty = OnEmpty.USE_NULL) EmbeddedId embeddedId;
@@ -522,7 +522,7 @@ static class DummyEntityWithEmbeddedId {
522522

523523
}
524524

525-
static class DummyEntityWithEmbeddedIdAndReference {
525+
static class WithEmbeddedIdAndReference {
526526

527527
@Id
528528
@Embedded(onEmpty = OnEmpty.USE_NULL) EmbeddedId embeddedId;

0 commit comments

Comments
 (0)