### Question:
TrimService { public int getLastTrimHeight() { TrimEntry trimEntry = trimDao.get(); return trimEntry == null ? 0 : Math.max(trimEntry.getHeight() - maxRollback, 0); } @Inject  TrimService(DatabaseManager databaseManager,
                       DerivedTablesRegistry derivedDbTablesRegistry,
                       GlobalSync globalSync,
                       TimeService timeService,
                       Event<TrimData> trimEvent,
                       Event<TrimConfig> trimConfigEvent,
                       TrimDao trimDao,
                       @Property(value = "apl.maxRollback", defaultValue = "720") int maxRollback
    ); int getLastTrimHeight(); void init(int height, int shardInitialBlockHeight); void trimDerivedTables(int height, boolean async); void doTrimDerivedTablesOnBlockchainHeight(int blockchainHeight, boolean async); void resetTrim(); void resetTrim(int height); int doTrimDerivedTablesOnHeightLocked(int height, boolean isSharding); void updateTrimConfig(boolean enableTrim, boolean clearQueue); boolean isTrimming(); void waitTrimming();  }### Answer:
@Test void testGetLastTrimHeightWhenTrimEntryIsNull() { int lastTrimHeight = trimService.getLastTrimHeight(); assertEquals(0, lastTrimHeight); }
@Test void testGetLastTrimHeightWhenTrimEntryIsNotNull() { doReturn(new TrimEntry(1L, 3000, true)).when(trimDao).get(); int lastTrimHeight = trimService.getLastTrimHeight(); assertEquals(2000, lastTrimHeight); }