### Question:
DaoStateSnapshotService { @VisibleForTesting int getSnapshotHeight(int genesisHeight, int height, int grid) { return Math.round(Math.max(genesisHeight + 3 * grid, height) / grid) * grid - grid; } @Inject  DaoStateSnapshotService(DaoStateService daoStateService,
                                   GenesisTxInfo genesisTxInfo,
                                   CycleService cycleService,
                                   DaoStateStorageService daoStateStorageService,
                                   DaoStateMonitoringService daoStateMonitoringService); void maybeCreateSnapshot(Block block); void applySnapshot(boolean fromReorg);  }### Answer:
@Test public void testGetSnapshotHeight() { assertEquals(120, daoStateSnapshotService.getSnapshotHeight(102, 0, 10)); assertEquals(120, daoStateSnapshotService.getSnapshotHeight(102, 100, 10)); assertEquals(120, daoStateSnapshotService.getSnapshotHeight(102, 102, 10)); assertEquals(120, daoStateSnapshotService.getSnapshotHeight(102, 119, 10)); assertEquals(120, daoStateSnapshotService.getSnapshotHeight(102, 120, 10)); assertEquals(120, daoStateSnapshotService.getSnapshotHeight(102, 121, 10)); assertEquals(120, daoStateSnapshotService.getSnapshotHeight(102, 130, 10)); assertEquals(120, daoStateSnapshotService.getSnapshotHeight(102, 139, 10)); assertEquals(130, daoStateSnapshotService.getSnapshotHeight(102, 140, 10)); assertEquals(130, daoStateSnapshotService.getSnapshotHeight(102, 141, 10)); assertEquals(990, daoStateSnapshotService.getSnapshotHeight(102, 1000, 10)); }