jojochuang commented on code in PR #9481:
URL: https://github.com/apache/ozone/pull/9481#discussion_r2611422180
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/diff/delta/TestRDBDifferComputer.java:
##########
@@ -375,11 +375,11 @@ public void testToDifferSnapshotInfoWithNoVersions()
throws IOException {
// Mock snapshot local data with empty versions
ReadableOmSnapshotLocalDataProvider snapProvider =
mock(ReadableOmSnapshotLocalDataProvider.class);
- OmSnapshotLocalData fromSnapshotLocalData =
mock(OmSnapshotLocalData.class);
+ Optional<OmSnapshotLocalData> fromSnapshotLocalData =
Optional.of(mock(OmSnapshotLocalData.class));
OmSnapshotLocalData toSnapshotLocalData =
createMockSnapshotLocalData(UUID.randomUUID(), 1);
- when(fromSnapshotLocalData.getSnapshotId()).thenReturn(snapshotId);
-
when(fromSnapshotLocalData.getVersionSstFileInfos()).thenReturn(Collections.emptyMap());
+ when(fromSnapshotLocalData.get().getSnapshotId()).thenReturn(snapshotId);
+
when(fromSnapshotLocalData.get().getVersionSstFileInfos()).thenReturn(Collections.emptyMap());
when(snapProvider.getPreviousSnapshotLocalData()).thenReturn(fromSnapshotLocalData);
Review Comment:
Doesn't look idiomatic, but i guess it works too.
Or try something like below:
```suggestion
OmSnapshotLocalData fromSnapshotMock = mock(OmSnapshotLocalData.class);
when(fromSnapshotMock.getSnapshotId()).thenReturn(snapshotId);
when(fromSnapshotMock.getVersionSstFileInfos()).thenReturn(Collections.emptyMap());
Optional<OmSnapshotLocalData> fromSnapshotLocalData =
Optional.of(fromSnapshotMock);
when(snapProvider.getPreviousSnapshotLocalData()).thenReturn(fromSnapshotLocalData);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]