CTGeofenceTaskManager { static CTGeofenceTaskManager getInstance() { if (taskManager == null) { synchronized (CTGeofenceTaskManager.class) { if (taskManager == null) { taskManager = new CTGeofenceTaskManager(); } } } return taskManager; } private  CTGeofenceTaskManager();   }
@Test public void testGetInstance() { CTGeofenceTaskManager instance = CTGeofenceTaskManager.getInstance(); Assert.assertNotNull(instance); CTGeofenceTaskManager instance1 = CTGeofenceTaskManager.getInstance(); Assert.assertSame(instance, instance1); }