@Test public void testGetInstance() { try(SettingsOverride override = SettingsOverride.apply(Map.of(AppSettings.PROVIDER_BACKEND, "com.example.DoesNotExist"))) { try { AbstractProvider.getInstance(); fail(); } catch (RuntimeException e) { assertEquals("java.lang.ClassNotFoundException: com.example.DoesNotExist", e.getMessage()); } } }
public static AbstractProvider getInstance() { String className = AppSettings.getInstance().getString(AppSettings.PROVIDER_BACKEND); if (instance == null || !className.equals(instance.getClass().getCanonicalName())) { instance = (AbstractProvider) InstanceUtils.invokeConstructor(className); } return instance; }
AbstractProvider { public static AbstractProvider getInstance() { String className = AppSettings.getInstance().getString(AppSettings.PROVIDER_BACKEND); if (instance == null || !className.equals(instance.getClass().getCanonicalName())) { instance = (AbstractProvider) InstanceUtils.invokeConstructor(className); } return instance; } }
AbstractProvider { public static AbstractProvider getInstance() { String className = AppSettings.getInstance().getString(AppSettings.PROVIDER_BACKEND); if (instance == null || !className.equals(instance.getClass().getCanonicalName())) { instance = (AbstractProvider) InstanceUtils.invokeConstructor(className); } return instance; }  }
AbstractProvider { public static AbstractProvider getInstance() { String className = AppSettings.getInstance().getString(AppSettings.PROVIDER_BACKEND); if (instance == null || !className.equals(instance.getClass().getCanonicalName())) { instance = (AbstractProvider) InstanceUtils.invokeConstructor(className); } return instance; }  static AbstractProvider getInstance(); abstract AccessToken getAccessToken(String googleIdentity, List<String> scopes); }
AbstractProvider { public static AbstractProvider getInstance() { String className = AppSettings.getInstance().getString(AppSettings.PROVIDER_BACKEND); if (instance == null || !className.equals(instance.getClass().getCanonicalName())) { instance = (AbstractProvider) InstanceUtils.invokeConstructor(className); } return instance; }  static AbstractProvider getInstance(); abstract AccessToken getAccessToken(String googleIdentity, List<String> scopes);  }