@@ -0,0 +1,3256 @@
+package org.ecommercesearch.remote.assetmanager.editor.service;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.mockito.Mockito.anyString;%0Aimport static org.mockito.Mockito.eq;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.times;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport atg.remote.assetmanager.editor.service.AssetService;%0Aimport org.ecommercesearch.repository.SynonymProperty;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0Aimport atg.remote.assetmanager.editor.model.PropertyUpdate;%0Aimport atg.remote.assetmanager.editor.service.AssetEditorInfo;%0A%0A/**%0A *%0A * @author rmerizalde%0A */%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class SynonymMappingAssetServiceTest %7B%0A%0A    private SynonymMappingAssetService service = new SynonymMappingAssetService();%0A%0A    @Mock%0A    private AssetEditorInfo assetEditorInfo;%0A    @Mock%0A    private AssetService assetService;%0A    @Mock%0A    private PropertyUpdate propertyUpdate;%0A%0A    @Before%0A    public void setup() %7B%0A        service.setLoggingDebug(false);%0A        when(assetEditorInfo.getAssetService()).thenReturn(assetService);%0A%0A    %7D%0A%0A    @Test%0A    public void test_invalidMapping() %7B%0A        when(propertyUpdate.getPropertyName()).thenReturn(SynonymProperty.MAPPING);%0A        when(propertyUpdate.getPropertyValue()).thenReturn(%22car%22);%0A%0A        service.doValidatePropertyUpdate(assetEditorInfo, propertyUpdate);%0A        verify(assetService).addError(SynonymProperty.MAPPING, SynonymMappingAssetService.ERROR_INVALID_SYNONYM_MAPPING);%0A    %7D%0A%0A    @Test%0A    public void test_validMapping() %7B%0A        when(propertyUpdate.getPropertyName()).thenReturn(SynonymProperty.MAPPING);%0A        when(propertyUpdate.getPropertyValue()).thenReturn(%22car,auto%22);%0A%0A        service.doValidatePropertyUpdate(assetEditorInfo, propertyUpdate);%0A        verify(assetService, times(0)).addError(anyString(), anyString());%0A    %7D%0A%0A    @Test%0A    public void test_invalidExplicitMapping() %7B%0A        when(propertyUpdate.getPropertyName()).thenReturn(SynonymProperty.MAPPING);%0A        when(propertyUpdate.getPropertyValue()).thenReturn(%22car=%3E%22);%0A%0A        service.doValidatePropertyUpdate(assetEditorInfo, propertyUpdate);%0A        verify(assetService).addError(SynonymProperty.MAPPING, SynonymMappingAssetService.ERROR_INVALID_EXPLICIT_SYNONYM_MAPPING);%0A    %7D%0A%0A    @Test%0A    public void test_validExplicitMapping() %7B%0A        when(propertyUpdate.getPropertyName()).thenReturn(SynonymProperty.MAPPING);%0A        when(propertyUpdate.getPropertyValue()).thenReturn(%22car=%3Eauto%22);%0A%0A        service.doValidatePropertyUpdate(assetEditorInfo, propertyUpdate);%0A        verify(assetService, times(0)).addError(anyString(), anyString());%0A    %7D%0A%0A    @Test%0A    public void test_validExplicitMappingMoreThenOneArrow() %7B%0A        when(propertyUpdate.getPropertyName()).thenReturn(SynonymProperty.MAPPING);%0A        when(propertyUpdate.getPropertyValue()).thenReturn(%22car=%3Eauto=%3Eautomobile%22);%0A%0A        service.doValidatePropertyUpdate(assetEditorInfo, propertyUpdate);%0A        verify(assetService).addError(SynonymProperty.MAPPING, SynonymMappingAssetService.ERROR_INVALID_EXPLICIT_SYNONYM_MAPPING);        %0A    %7D%0A%7D%0A%0A

Test class for Synonym AssetService