### Question:
LockService { public static LockService getInstance(Database database) { if (!instances.containsKey(database)) { instances.put(database, new LockService(database)); } return instances.get(database); } private  LockService(Database database); static LockService getInstance(Database database); void setChangeLogLockWaitTime(long changeLogLockWaitTime); void setChangeLogLockRecheckTime(long changeLogLocRecheckTime); boolean hasChangeLogLock(); void waitForLock(); boolean acquireLock(); void releaseLock(); DatabaseChangeLogLock[] listLocks(); void forceReleaseLock(); void reset(); static void resetAll();  }### Answer:
@Test public void getInstance() { final Database oracle1 = new OracleDatabase() { @Override public boolean equals(Object o) { return o == this; } }; final Database oracle2 = new OracleDatabase() { @Override public boolean equals(Object o) { return o == this; } }; final Database mysql = new MySQLDatabase() { @Override public boolean equals(Object o) { return o == this; } }; assertNotNull(LockService.getInstance(oracle1)); assertNotNull(LockService.getInstance(oracle2)); assertNotNull(LockService.getInstance(mysql)); assertTrue(LockService.getInstance(oracle1) == LockService.getInstance(oracle1)); assertTrue(LockService.getInstance(oracle2) == LockService.getInstance(oracle2)); assertTrue(LockService.getInstance(mysql) == LockService.getInstance(mysql)); assertTrue(LockService.getInstance(oracle1) != LockService.getInstance(oracle2)); assertTrue(LockService.getInstance(oracle1) != LockService.getInstance(mysql)); }