Skip to content

Commit 237df08

Browse files
committed
Add test cases.
Relates to #60
1 parent 173b695 commit 237df08

135 files changed

Lines changed: 13707 additions & 6106 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

storm-core/src/test/java/st/orm/core/BuilderExtendedIntegrationTest.java renamed to storm-core/src/test/java/st/orm/core/BuilderIntegrationTest.java

Lines changed: 1 addition & 89 deletions
Large diffs are not rendered by default.

storm-core/src/test/java/st/orm/core/DatabaseSchemaIntegrationTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class DatabaseSchemaIntegrationTest {
3737
@Autowired
3838
private DataSource dataSource;
3939

40-
// ---- Table existence ----
40+
// Table existence
4141

4242
@Test
4343
public void testCoreTablesExist() throws SQLException {
@@ -73,7 +73,7 @@ public void testNonExistentTableNotFound() throws SQLException {
7373
}
7474
}
7575

76-
// ---- Views ----
76+
// Views
7777

7878
@Test
7979
public void testViewsExist() throws SQLException {
@@ -95,7 +95,7 @@ public void testViewColumns() throws SQLException {
9595
}
9696
}
9797

98-
// ---- Column metadata ----
98+
// Column metadata
9999

100100
@Test
101101
public void testCityColumns() throws SQLException {
@@ -145,7 +145,7 @@ public void testVetSpecialtySpecialtyIdNotNullable() throws SQLException {
145145
}
146146
}
147147

148-
// ---- Primary keys ----
148+
// Primary keys
149149

150150
@Test
151151
public void testCityPrimaryKey() throws SQLException {
@@ -176,7 +176,7 @@ public void testPrimaryKeysForViewEmpty() throws SQLException {
176176
}
177177
}
178178

179-
// ---- Foreign keys ----
179+
// Foreign keys
180180

181181
@Test
182182
public void testOwnerForeignKeyToCity() throws SQLException {
@@ -237,7 +237,7 @@ public void testForeignKeysForTableWithNone() throws SQLException {
237237
}
238238
}
239239

240-
// ---- Unique keys ----
240+
// Unique keys
241241

242242
@Test
243243
public void testUniqueKeysForNonExistentTable() throws SQLException {
@@ -248,7 +248,7 @@ public void testUniqueKeysForNonExistentTable() throws SQLException {
248248
}
249249
}
250250

251-
// ---- JDBC_METADATA strategy ----
251+
// JDBC_METADATA strategy
252252

253253
@Test
254254
public void testReadWithJdbcMetadataStrategy() throws SQLException {
@@ -275,7 +275,7 @@ public void testReadWithJdbcMetadataStrategy() throws SQLException {
275275
}
276276
}
277277

278-
// ---- Polymorphic tables ----
278+
// Polymorphic tables
279279

280280
@Test
281281
public void testPolymorphicTablesExist() throws SQLException {
@@ -304,7 +304,7 @@ public void testJoinedInheritanceForeignKeys() throws SQLException {
304304
}
305305
}
306306

307-
// ---- DbColumn record properties ----
307+
// DbColumn record properties
308308

309309
@Test
310310
public void testDbColumnRecordProperties() throws SQLException {
@@ -318,7 +318,7 @@ public void testDbColumnRecordProperties() throws SQLException {
318318
}
319319
}
320320

321-
// ---- DbPrimaryKey record properties ----
321+
// DbPrimaryKey record properties
322322

323323
@Test
324324
public void testDbPrimaryKeyRecordProperties() throws SQLException {
@@ -332,7 +332,7 @@ public void testDbPrimaryKeyRecordProperties() throws SQLException {
332332
}
333333
}
334334

335-
// ---- Sequence discovery (H2 supports INFORMATION_SCHEMA.SEQUENCES) ----
335+
// Sequence discovery (H2 supports INFORMATION_SCHEMA.SEQUENCES)
336336

337337
@Test
338338
public void testSequenceNotExistsByDefault() throws SQLException {
@@ -343,7 +343,7 @@ public void testSequenceNotExistsByDefault() throws SQLException {
343343
}
344344
}
345345

346-
// ---- Null schema/catalog handling ----
346+
// Null schema/catalog handling
347347

348348
@Test
349349
public void testReadWithNullCatalogAndSchema() throws SQLException {

storm-core/src/test/java/st/orm/core/DynamicUpdateIntegrationTest.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ public record VisitFieldValue(
107107
@Version Instant timestamp
108108
) implements Entity<Integer> {}
109109

110-
// ------------------------------------------------------------
111110
// Expected SQL
112-
// ------------------------------------------------------------
113111

114112
private static final String FULL_UPDATE_SQL = """
115113
UPDATE visit
@@ -121,9 +119,7 @@ public record VisitFieldValue(
121119
SET pet_id = ?, "timestamp" = CURRENT_TIMESTAMP
122120
WHERE id = ? AND "timestamp" = ?""";
123121

124-
// ------------------------------------------------------------
125122
// OFF: always updates all columns, dirtyCheck irrelevant
126-
// ------------------------------------------------------------
127123

128124
@Test
129125
void off_default_alwaysUpdates_evenIfNoChanges() {
@@ -150,11 +146,9 @@ void off_value_alwaysUpdates_evenIfNoChanges() {
150146
assertEquals(FULL_UPDATE_SQL, sql.statement());
151147
}
152148

153-
// ------------------------------------------------------------
154149
// ENTITY: full update SQL, dirty detection is per-column
155150
// DEFAULT = instance-based dirty check
156151
// VALUE = semantic value-based dirty check
157-
// ------------------------------------------------------------
158152

159153
@Test
160154
void entity_default_skipsUpdate_whenNoMappedColumnChanges() {
@@ -231,11 +225,9 @@ void entity_value_skipsUpdate_whenFkIdSameEvenIfInstanceChanges() {
231225
assertNull(sql);
232226
}
233227

234-
// ------------------------------------------------------------
235228
// FIELD: updates only changed columns (plus version)
236229
// DEFAULT = instance-based dirty check
237230
// VALUE = semantic value-based dirty check
238-
// ------------------------------------------------------------
239231

240232
@Test
241233
void field_default_skipsUpdate_whenNoMappedColumnChanges() {
@@ -312,9 +304,7 @@ void field_value_skipsUpdate_whenFkIdSameEvenIfInstanceChanges() {
312304
assertNull(sql);
313305
}
314306

315-
// ------------------------------------------------------------
316307
// Helpers
317-
// ------------------------------------------------------------
318308

319309
private Sql captureFirstUpdateSql(ThrowingSupplier<?> action) {
320310
AtomicReference<Sql> ref = new AtomicReference<>();

0 commit comments

Comments
 (0)