1 /*******************************************************************************
2 * Copyright (c) 2014 Obeo.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Obeo - initial API and implementation
10 *******************************************************************************/
11 package org
.eclipse
.emf
.compare
.ide
.ui
.tests
.compareconfiguration
;
13 import static org
.junit
.Assert
.assertEquals
;
14 import static org
.junit
.Assert
.assertNotNull
;
16 import org
.eclipse
.compare
.CompareConfiguration
;
17 import org
.eclipse
.emf
.compare
.ide
.ui
.internal
.EMFCompareIDEUIPlugin
;
18 import org
.eclipse
.emf
.compare
.ide
.ui
.internal
.configuration
.EMFCompareConfiguration
;
19 import org
.junit
.Test
;
21 @SuppressWarnings({"restriction", "nls" })
22 public class EMFCompareConfigurationTest
{
25 public void testEMFCompareConfigurationDefaultValues() {
26 CompareConfiguration cc
= new CompareConfiguration();
27 cc
.setLeftEditable(true);
28 cc
.setRightEditable(true);
29 EMFCompareConfiguration emfCC
= new EMFCompareConfiguration(cc
);
30 // From now, the following properties are not null:
31 // PREVIEW_MERGE_MODE, SMV_FILTERS, SMV_GROUP_PROVIDERS, EVENT_BUS.
32 Object preview_mode
= emfCC
.getProperty(EMFCompareIDEUIPlugin
.PLUGIN_ID
+ ".PREVIEW_MERGE_MODE");
33 assertNotNull(preview_mode
);
34 Object smv_filters
= emfCC
.getProperty(EMFCompareIDEUIPlugin
.PLUGIN_ID
+ ".SMV_FILTERS");
35 assertNotNull(smv_filters
);
36 Object smv_group_providers
= emfCC
.getProperty(EMFCompareIDEUIPlugin
.PLUGIN_ID
37 + ".SMV_GROUP_PROVIDERS");
38 assertNotNull(smv_group_providers
);
39 Object event_bus
= emfCC
.getProperty(EMFCompareIDEUIPlugin
.PLUGIN_ID
+ ".EVENT_BUS");
40 assertNotNull(event_bus
);
41 // Simulate a change of viewer, so a new instantiation of EMFCompareConfiguration.
42 EMFCompareConfiguration emfCC2
= new EMFCompareConfiguration(cc
);
43 Object preview_mode2
= emfCC2
.getProperty(EMFCompareIDEUIPlugin
.PLUGIN_ID
+ ".PREVIEW_MERGE_MODE");
44 assertEquals(preview_mode
, preview_mode2
);
45 Object smv_filters2
= emfCC2
.getProperty(EMFCompareIDEUIPlugin
.PLUGIN_ID
+ ".SMV_FILTERS");
46 assertEquals(smv_filters
, smv_filters2
);
47 Object smv_group_providers2
= emfCC2
.getProperty(EMFCompareIDEUIPlugin
.PLUGIN_ID
48 + ".SMV_GROUP_PROVIDERS");
49 assertEquals(smv_group_providers
, smv_group_providers2
);
50 Object event_bus2
= emfCC2
.getProperty(EMFCompareIDEUIPlugin
.PLUGIN_ID
+ ".EVENT_BUS");
51 assertEquals(event_bus
, event_bus2
);