@Test public void testGetCurrentConfigAsyncSuccessCurrentConfigNotSetDiskConfigNotExist() throws Exception { File configFile = new File(temporaryFolder.getRoot(), "config"); ParseCurrentConfigController currentConfigController = new ParseCurrentConfigController(configFile); assertFalse(configFile.exists()); assertNull(currentConfigController.currentConfig); Task<ParseConfig> getTask = currentConfigController.getCurrentConfigAsync(); ParseTaskUtils.wait(getTask); ParseConfig config = getTask.getResult(); assertSame(config, currentConfigController.currentConfig); assertEquals(0, config.getParams().size()); }
public Task<ParseConfig> getCurrentConfigAsync() { return Task.call(new Callable<ParseConfig>() { @Override public ParseConfig call() { synchronized (currentConfigMutex) { if (currentConfig == null) { ParseConfig config = getFromDisk(); currentConfig = (config != null) ? config : new ParseConfig(); } } return currentConfig; } }, ParseExecutors.io()); }
ParseCurrentConfigController { public Task<ParseConfig> getCurrentConfigAsync() { return Task.call(new Callable<ParseConfig>() { @Override public ParseConfig call() { synchronized (currentConfigMutex) { if (currentConfig == null) { ParseConfig config = getFromDisk(); currentConfig = (config != null) ? config : new ParseConfig(); } } return currentConfig; } }, ParseExecutors.io()); } }
ParseCurrentConfigController { public Task<ParseConfig> getCurrentConfigAsync() { return Task.call(new Callable<ParseConfig>() { @Override public ParseConfig call() { synchronized (currentConfigMutex) { if (currentConfig == null) { ParseConfig config = getFromDisk(); currentConfig = (config != null) ? config : new ParseConfig(); } } return currentConfig; } }, ParseExecutors.io()); } ParseCurrentConfigController(File currentConfigFile); }
ParseCurrentConfigController { public Task<ParseConfig> getCurrentConfigAsync() { return Task.call(new Callable<ParseConfig>() { @Override public ParseConfig call() { synchronized (currentConfigMutex) { if (currentConfig == null) { ParseConfig config = getFromDisk(); currentConfig = (config != null) ? config : new ParseConfig(); } } return currentConfig; } }, ParseExecutors.io()); } ParseCurrentConfigController(File currentConfigFile); Task<Void> setCurrentConfigAsync(final ParseConfig config); Task<ParseConfig> getCurrentConfigAsync(); }
ParseCurrentConfigController { public Task<ParseConfig> getCurrentConfigAsync() { return Task.call(new Callable<ParseConfig>() { @Override public ParseConfig call() { synchronized (currentConfigMutex) { if (currentConfig == null) { ParseConfig config = getFromDisk(); currentConfig = (config != null) ? config : new ParseConfig(); } } return currentConfig; } }, ParseExecutors.io()); } ParseCurrentConfigController(File currentConfigFile); Task<Void> setCurrentConfigAsync(final ParseConfig config); Task<ParseConfig> getCurrentConfigAsync();  }