### Question:
StorageNodeConfigurationUtil { public static void syncConfigs(StorageNodeConfigurationComposite newConfig, StorageNodeConfigurationComposite oldConfig) { try { for (Field field : StorageNodeConfigurationComposite.class.getDeclaredFields()) { field.setAccessible(true); if(field.isAccessible() && field.getType() != StorageNode.class) { Object o = field.get(newConfig); if(o == null) { Object oldValue = field.get(oldConfig); if(oldValue != null) { field.set(newConfig, oldValue); } } } } } catch (IllegalAccessException e) { throw new RuntimeException("Could not process StorageNodeConfigurationComposite, ", e); } }  static StorageNodeConfigurationComposite createCompositeConfiguration(Configuration storageNodeConfiguration, Configuration storageNodePluginConfiguration, StorageNode storageNode); static void updateValuesToConfiguration(StorageNodeConfigurationComposite storageNodeConfigurationComposite, Configuration storageNodeConfiguration); static PropertyList getAllDataFileLocationsProperties(List<String> fileLocations); static void syncConfigs(StorageNodeConfigurationComposite newConfig, StorageNodeConfigurationComposite oldConfig); static final String RHQ_STORAGE_JMX_PORT_PROPERTY; static final String RHQ_STORAGE_HEAP_MAX_PROPERTY; static final String RHQ_STORAGE_HEAP_MIN_PROPERTY; static final String RHQ_STORAGE_HEAP_NEW_PROPERTY; static final String RHQ_STORAGE_THREAD_STACK_PROPERTY; static final String RHQ_STORAGE_SAVED_CACHES_PROPERTY; static final String RHQ_STORAGE_COMMIT_LOG_PROPERTY; static final String RHQ_STORAGE_DATA_FILE_PROPERTY; static final String RHQ_STORAGE_DATA_FILE_DIR_PROPERTY; static final String RHQ_STORAGE_CONNECTOR_PROPERTY; static final String RHQ_STORAGE_NOTIFY_DIR_CHANGE_PROPERTY; }### Answer:
@Test public void testConfigurationSync() throws Exception { StorageNode mockStorageNode = Mockito.mock(StorageNode.class); StorageNodeConfigurationComposite oldConfig = new StorageNodeConfigurationComposite(mockStorageNode); StorageNodeConfigurationComposite newConfig = new StorageNodeConfigurationComposite(mockStorageNode); String oldLogLocationValue = "oldLogLocation"; oldConfig.setCommitLogLocation(oldLogLocationValue); String heapNewSize = "384m"; newConfig.setHeapNewSize(heapNewSize); String newCacheLocationValue = "newCacheLocation"; String oldCacheLocationValue = "oldCacheLocation"; newConfig.setSavedCachesLocation(newCacheLocationValue); oldConfig.setSavedCachesLocation(oldCacheLocationValue); StorageNodeConfigurationUtil.syncConfigs(newConfig, oldConfig); assertEquals(newConfig.getCommitLogLocation(), oldLogLocationValue); assertEquals(newConfig.getHeapNewSize(), heapNewSize); assertNull(oldConfig.getHeapNewSize()); assertEquals(newConfig.getSavedCachesLocation(), newCacheLocationValue); assertEquals(oldConfig.getSavedCachesLocation(), oldCacheLocationValue); }