AbstractDatabaseBackend { public static AbstractDatabaseBackend getInstance() { String className = AppSettings.getInstance().getString(AppSettings.DATABASE_BACKEND); if (instance == null || !className.equals(instance.getClass().getCanonicalName())) { instance = (AbstractDatabaseBackend) InstanceUtils.invokeConstructor(className); } return instance; }  abstract List<Model> getAll(Class modelClass); abstract Model get(Class modelClass, String objectId); abstract void save(Model model); abstract void delete(Model model); int deleteExpiredItems(Class modelClass, String field, Long cutoffTime); abstract int deleteExpiredItems(Class modelClass, String field, Long cutoffTime, Integer numItems); abstract void initializeDatabase(); abstract CheckResult checkConnection(); static AbstractDatabaseBackend getInstance();  }
@Test public void testGetInstance() { try(SettingsOverride override = SettingsOverride.apply(Map.of(AppSettings.DATABASE_BACKEND, "com.example.DoesNotExist"))) { try { AbstractDatabaseBackend.getInstance(); fail(); } catch (RuntimeException e) { assertEquals("java.lang.ClassNotFoundException: com.example.DoesNotExist", e.getMessage()); } } }