AppCenter { public static void setCustomProperties(CustomProperties customProperties) { getInstance().setInstanceCustomProperties(customProperties); }  static synchronized AppCenter getInstance(); @SuppressWarnings("WeakerAccess") static void setWrapperSdk(WrapperSdk wrapperSdk); @IntRange(from = VERBOSE, to = NONE) static int getLogLevel(); static void setLogLevel(@IntRange(from = VERBOSE, to = NONE) int logLevel); static void setLogUrl(String logUrl); @SuppressWarnings({"WeakerAccess", "SameReturnValue"}) static String getSdkVersion(); static void setCustomProperties(CustomProperties customProperties); static boolean isConfigured(); static boolean isRunningInAppCenterTestCloud(); static void configure(Application application, String appSecret); static void configure(Application application); @SafeVarargs static void start(Class<? extends AppCenterService>... services); @SafeVarargs static void start(Application application, String appSecret, Class<? extends AppCenterService>... services); @SafeVarargs static void start(Application application, Class<? extends AppCenterService>... services); @SafeVarargs static void startFromLibrary(Context context, Class<? extends AppCenterService>... services); static AppCenterFuture<Boolean> isEnabled(); static AppCenterFuture<Void> setEnabled(boolean enabled); static AppCenterFuture<UUID> getInstallId(); static AppCenterFuture<Boolean> setMaxStorageSize(long storageSizeInBytes); static void setUserId(String userId); @VisibleForTesting void setChannel(Channel channel); static final String LOG_TAG; }
@Test public void setCustomPropertiesTest() throws Exception { CustomPropertiesLog log = mock(CustomPropertiesLog.class); whenNew(CustomPropertiesLog.class).withAnyArguments().thenReturn(log); AppCenter.setCustomProperties(new CustomProperties().clear("test")); verify(mChannel, never()).enqueue(eq(log), eq(CORE_GROUP), anyInt()); verifyStatic(times(1)); AppCenterLog.error(eq(LOG_TAG), anyString()); AppCenter.start(mApplication, DUMMY_APP_SECRET, DummyService.class); AppCenter.setCustomProperties(null); verify(mChannel, never()).enqueue(eq(log), eq(CORE_GROUP), anyInt()); verifyStatic(times(2)); AppCenterLog.error(eq(LOG_TAG), anyString()); CustomProperties empty = new CustomProperties(); AppCenter.setCustomProperties(empty); verify(mChannel, never()).enqueue(eq(log), eq(CORE_GROUP), anyInt()); verifyStatic(times(3)); AppCenterLog.error(eq(LOG_TAG), anyString()); CustomProperties properties = new CustomProperties(); properties.set("test", "test"); AppCenter.setCustomProperties(properties); verify(log).setProperties(eq(properties.getProperties())); verify(mChannel).enqueue(eq(log), eq(CORE_GROUP), eq(DEFAULTS)); AppCenter.setEnabled(false); AppCenter.setCustomProperties(properties); verifyStatic(times(4)); AppCenterLog.error(eq(LOG_TAG), anyString()); verify(mChannel).enqueue(eq(log), eq(CORE_GROUP), eq(DEFAULTS)); }