@@ -74,7 +74,8 @@ void setup() {
7474 private TableMetadata createMetadataWithSnapshots (
7575 TableMetadata base , List <Snapshot > snapshots , Map <String , String > refs ) {
7676 Map <String , String > properties = new HashMap <>(base .properties ());
77- properties .put (CatalogConstants .SNAPSHOTS_JSON_KEY , SnapshotsUtil .serializedSnapshots (snapshots ));
77+ properties .put (
78+ CatalogConstants .SNAPSHOTS_JSON_KEY , SnapshotsUtil .serializedSnapshots (snapshots ));
7879 if (refs != null ) {
7980 properties .put (CatalogConstants .SNAPSHOTS_REFS_KEY , SnapshotsUtil .serializeMap (refs ));
8081 }
@@ -148,7 +149,8 @@ void testApplySnapshots_addNewSnapshots_success() throws IOException {
148149
149150 List <Snapshot > allSnapshots = new ArrayList <>(initialSnapshots );
150151 allSnapshots .addAll (IcebergTestUtil .getExtraSnapshots ());
151- TableMetadata newMetadata = createMetadataWithSnapshotsAndMainRef (baseWithSnapshots , allSnapshots );
152+ TableMetadata newMetadata =
153+ createMetadataWithSnapshotsAndMainRef (baseWithSnapshots , allSnapshots );
152154
153155 TableMetadata result = snapshotDiffApplier .applySnapshots (baseWithSnapshots , newMetadata );
154156
@@ -164,7 +166,8 @@ void testApplySnapshots_deleteSnapshots_success() throws IOException {
164166 TableMetadata baseWithSnapshots = addSnapshotsToMetadata (baseMetadata , snapshots );
165167
166168 List <Snapshot > remainingSnapshots = snapshots .subList (1 , snapshots .size ());
167- TableMetadata newMetadata = createMetadataWithSnapshotsAndMainRef (baseWithSnapshots , remainingSnapshots );
169+ TableMetadata newMetadata =
170+ createMetadataWithSnapshotsAndMainRef (baseWithSnapshots , remainingSnapshots );
168171
169172 TableMetadata result = snapshotDiffApplier .applySnapshots (baseWithSnapshots , newMetadata );
170173
@@ -201,7 +204,8 @@ void testApplySnapshots_multipleBranchUpdates_success() throws IOException {
201204 snapshotRefs .put (SnapshotRef .MAIN_BRANCH , org .apache .iceberg .SnapshotRefParser .toJson (mainRef ));
202205 snapshotRefs .put ("dev" , org .apache .iceberg .SnapshotRefParser .toJson (devRef ));
203206
204- TableMetadata newMetadata = createMetadataWithSnapshots (baseWithSnapshots , snapshots , snapshotRefs );
207+ TableMetadata newMetadata =
208+ createMetadataWithSnapshots (baseWithSnapshots , snapshots , snapshotRefs );
205209
206210 TableMetadata result = snapshotDiffApplier .applySnapshots (baseWithSnapshots , newMetadata );
207211
@@ -218,7 +222,8 @@ void testValidation_deletingCurrentSnapshotWithoutReplacement_throwsException()
218222 List <Snapshot > snapshots = IcebergTestUtil .getSnapshots ();
219223 TableMetadata baseWithSnapshots = addSnapshotsToMetadata (baseMetadata , snapshots );
220224
221- TableMetadata newMetadata = createMetadataWithSnapshots (baseWithSnapshots , Collections .emptyList (), new HashMap <>());
225+ TableMetadata newMetadata =
226+ createMetadataWithSnapshots (baseWithSnapshots , Collections .emptyList (), new HashMap <>());
222227
223228 InvalidIcebergSnapshotException exception =
224229 assertThrows (
@@ -240,7 +245,8 @@ void testValidation_multipleBranchesToSameSnapshot_throwsException() throws IOEx
240245 snapshotRefs .put ("branch1" , org .apache .iceberg .SnapshotRefParser .toJson (ref ));
241246 snapshotRefs .put ("branch2" , org .apache .iceberg .SnapshotRefParser .toJson (ref ));
242247
243- TableMetadata newMetadata = createMetadataWithSnapshots (baseWithSnapshots , snapshots , snapshotRefs );
248+ TableMetadata newMetadata =
249+ createMetadataWithSnapshots (baseWithSnapshots , snapshots , snapshotRefs );
244250
245251 InvalidIcebergSnapshotException exception =
246252 assertThrows (
@@ -264,7 +270,8 @@ void testValidation_deletingReferencedSnapshot_throwsException() throws IOExcept
264270 SnapshotRef ref = SnapshotRef .branchBuilder (snapshotToDelete .snapshotId ()).build ();
265271 snapshotRefs .put (SnapshotRef .MAIN_BRANCH , org .apache .iceberg .SnapshotRefParser .toJson (ref ));
266272
267- TableMetadata newMetadata = createMetadataWithSnapshots (baseWithSnapshots , remainingSnapshots , snapshotRefs );
273+ TableMetadata newMetadata =
274+ createMetadataWithSnapshots (baseWithSnapshots , remainingSnapshots , snapshotRefs );
268275
269276 InvalidIcebergSnapshotException exception =
270277 assertThrows (
@@ -287,13 +294,15 @@ void testMetrics_wapSnapshots_recordsStagedCounter() throws IOException {
287294 List <Snapshot > allSnapshots = new ArrayList <>(baseSnapshots );
288295 allSnapshots .addAll (wapSnapshots );
289296
290- Map <String , String > refs = IcebergTestUtil .obtainSnapshotRefsFromSnapshot (baseSnapshots .get (baseSnapshots .size () - 1 ));
297+ Map <String , String > refs =
298+ IcebergTestUtil .obtainSnapshotRefsFromSnapshot (baseSnapshots .get (baseSnapshots .size () - 1 ));
291299 TableMetadata newMetadata = createMetadataWithSnapshots (baseWithSnapshots , allSnapshots , refs );
292300
293301 TableMetadata result = snapshotDiffApplier .applySnapshots (baseWithSnapshots , newMetadata );
294302
295303 assertNotNull (result );
296- verify (mockMetricsReporter ).count (eq (InternalCatalogMetricsConstant .SNAPSHOTS_STAGED_CTR ), anyDouble ());
304+ verify (mockMetricsReporter )
305+ .count (eq (InternalCatalogMetricsConstant .SNAPSHOTS_STAGED_CTR ), anyDouble ());
297306 }
298307
299308 /** Verifies that deleting snapshots triggers the correct metrics. */
@@ -303,13 +312,15 @@ void testMetrics_deleteSnapshots_recordsDeletedCounter() throws IOException {
303312 TableMetadata baseWithSnapshots = addSnapshotsToMetadata (baseMetadata , snapshots );
304313
305314 List <Snapshot > remainingSnapshots = snapshots .subList (1 , snapshots .size ());
306- TableMetadata newMetadata = createMetadataWithSnapshotsAndMainRef (baseWithSnapshots , remainingSnapshots );
315+ TableMetadata newMetadata =
316+ createMetadataWithSnapshotsAndMainRef (baseWithSnapshots , remainingSnapshots );
307317
308318 TableMetadata result = snapshotDiffApplier .applySnapshots (baseWithSnapshots , newMetadata );
309319
310320 assertNotNull (result );
311321 assertEquals (remainingSnapshots .size (), result .snapshots ().size ());
312- verify (mockMetricsReporter ).count (eq (InternalCatalogMetricsConstant .SNAPSHOTS_DELETED_CTR ), eq (1.0 ));
322+ verify (mockMetricsReporter )
323+ .count (eq (InternalCatalogMetricsConstant .SNAPSHOTS_DELETED_CTR ), eq (1.0 ));
313324 }
314325
315326 // ========== Property Management Tests ==========
@@ -323,17 +334,20 @@ void testProperties_appendedSnapshots_recordedCorrectly() throws IOException {
323334 List <Snapshot > newSnapshotsList = IcebergTestUtil .getExtraSnapshots ();
324335 List <Snapshot > allSnapshots = new ArrayList <>(baseSnapshots );
325336 allSnapshots .addAll (newSnapshotsList );
326- TableMetadata newMetadata = createMetadataWithSnapshotsAndMainRef (baseWithSnapshots , allSnapshots );
337+ TableMetadata newMetadata =
338+ createMetadataWithSnapshotsAndMainRef (baseWithSnapshots , allSnapshots );
327339
328340 TableMetadata result = snapshotDiffApplier .applySnapshots (baseWithSnapshots , newMetadata );
329341
330342 assertNotNull (result );
331- String appendedSnapshots = result .properties ().get (getCanonicalFieldName (CatalogConstants .APPENDED_SNAPSHOTS ));
343+ String appendedSnapshots =
344+ result .properties ().get (getCanonicalFieldName (CatalogConstants .APPENDED_SNAPSHOTS ));
332345 assertNotNull (appendedSnapshots , "Appended snapshots should be recorded in properties" );
333346
334347 // Verify actual snapshot IDs are present
335348 for (Snapshot newSnapshot : newSnapshotsList ) {
336- assertTrue (appendedSnapshots .contains (String .valueOf (newSnapshot .snapshotId ())),
349+ assertTrue (
350+ appendedSnapshots .contains (String .valueOf (newSnapshot .snapshotId ())),
337351 "Snapshot ID " + newSnapshot .snapshotId () + " should be in appended_snapshots" );
338352 }
339353 }
@@ -347,9 +361,11 @@ void testProperties_tempKeysRemoved_success() throws IOException {
347361 TableMetadata result = snapshotDiffApplier .applySnapshots (null , newMetadata );
348362
349363 assertNotNull (result );
350- assertFalse (result .properties ().containsKey (CatalogConstants .SNAPSHOTS_JSON_KEY ),
364+ assertFalse (
365+ result .properties ().containsKey (CatalogConstants .SNAPSHOTS_JSON_KEY ),
351366 "Temp snapshots JSON key should be removed" );
352- assertFalse (result .properties ().containsKey (CatalogConstants .SNAPSHOTS_REFS_KEY ),
367+ assertFalse (
368+ result .properties ().containsKey (CatalogConstants .SNAPSHOTS_REFS_KEY ),
353369 "Temp snapshots refs key should be removed" );
354370 }
355371}
0 commit comments