Skip to content

Package: DefaultViewModelProperties_Test

DefaultViewModelProperties_Test

nameinstructionbranchcomplexitylinemethod
DefaultViewModelProperties_Test()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
before()
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
testAddInheritablePropertyEmpty()
M: 0 C: 26
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testAddInheritablePropertyKeyUsedInInheritable()
M: 0 C: 34
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
testAddInheritablePropertyKeyUsedInNonInheritable()
M: 0 C: 34
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
testAddNonInheritablePropertyEmpty()
M: 0 C: 26
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testAddNonInheritablePropertyKeyUsedInInheritable()
M: 0 C: 34
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
testAddNonInheritablePropertyKeyUsedInNonInheritable()
M: 0 C: 34
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
testContainsKeyEmpty()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
testContainsKeyInherited()
M: 0 C: 13
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
testContainsKeyNonInherited()
M: 0 C: 13
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
testGetEmpty()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
testGetInherited()
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
testGetNonInherited()
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
testInherit()
M: 0 C: 62
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 11
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Johannes Faltermeier - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.model.test;
15:
16: import static org.junit.Assert.assertEquals;
17: import static org.junit.Assert.assertFalse;
18: import static org.junit.Assert.assertNull;
19: import static org.junit.Assert.assertTrue;
20:
21: import org.eclipse.emf.ecp.view.spi.model.VViewFactory;
22: import org.eclipse.emf.ecp.view.spi.model.VViewModelLoadingProperties;
23: import org.junit.Before;
24: import org.junit.Test;
25:
26: public class DefaultViewModelProperties_Test {
27:
28:         private static final String KEY1 = "key1";
29:         private static final String VALUE1 = "value1";
30:
31:         private static final String KEY2 = "key2";
32:         private static final String VALUE2 = "value2";
33:
34:         private VViewModelLoadingProperties properties;
35:
36:         @Before
37:         public void before() {
38:                 properties = VViewFactory.eINSTANCE.createViewModelLoadingProperties();
39:         }
40:
41:         @Test
42:         public void testContainsKeyEmpty() {
43:                 assertFalse(properties.containsKey(KEY1));
44:         }
45:
46:         @Test
47:         public void testContainsKeyInherited() {
48:                 properties.getInheritableProperties().put(KEY1, VALUE1);
49:                 assertTrue(properties.containsKey(KEY1));
50:         }
51:
52:         @Test
53:         public void testContainsKeyNonInherited() {
54:                 properties.getNonInheritableProperties().put(KEY1, VALUE1);
55:                 assertTrue(properties.containsKey(KEY1));
56:         }
57:
58:         @Test
59:         public void testGetEmpty() {
60:                 assertNull(properties.get(KEY1));
61:         }
62:
63:         @Test
64:         public void testGetInherited() {
65:                 properties.getInheritableProperties().put(KEY1, VALUE1);
66:                 assertEquals(VALUE1, properties.get(KEY1));
67:         }
68:
69:         @Test
70:         public void testGetNonInherited() {
71:                 properties.getNonInheritableProperties().put(KEY1, VALUE1);
72:                 assertEquals(VALUE1, properties.get(KEY1));
73:         }
74:
75:         @Test
76:         public void testInherit() {
77:                 properties.getInheritableProperties().put(KEY1, VALUE1);
78:                 properties.getNonInheritableProperties().put(KEY2, VALUE2);
79:                 final VViewModelLoadingProperties inherit = (VViewModelLoadingProperties) properties.inherit();
80:                 assertTrue(inherit.getNonInheritableProperties().isEmpty());
81:                 assertEquals(1, inherit.getInheritableProperties().size());
82:                 assertEquals(VALUE1, inherit.getInheritableProperties().get(KEY1));
83:                 assertEquals(1, properties.getInheritableProperties().size());
84:                 assertEquals(1, properties.getNonInheritableProperties().size());
85:                 assertEquals(VALUE1, properties.get(KEY1));
86:                 assertEquals(VALUE2, properties.get(KEY2));
87:         }
88:
89:         @Test
90:         public void testAddInheritablePropertyEmpty() {
91:                 assertNull(properties.addInheritableProperty(KEY1, VALUE1));
92:                 assertTrue(properties.getNonInheritableProperties().isEmpty());
93:                 assertEquals(1, properties.getInheritableProperties().size());
94:                 assertEquals(VALUE1, properties.getInheritableProperties().get(KEY1));
95:         }
96:
97:         @Test
98:         public void testAddInheritablePropertyKeyUsedInInheritable() {
99:                 properties.getInheritableProperties().put(KEY1, VALUE2);
100:                 assertEquals(VALUE2, properties.addInheritableProperty(KEY1, VALUE1));
101:                 assertTrue(properties.getNonInheritableProperties().isEmpty());
102:                 assertEquals(1, properties.getInheritableProperties().size());
103:                 assertEquals(VALUE1, properties.getInheritableProperties().get(KEY1));
104:         }
105:
106:         @Test
107:         public void testAddInheritablePropertyKeyUsedInNonInheritable() {
108:                 properties.getNonInheritableProperties().put(KEY1, VALUE2);
109:                 assertEquals(VALUE2, properties.addInheritableProperty(KEY1, VALUE1));
110:                 assertTrue(properties.getNonInheritableProperties().isEmpty());
111:                 assertEquals(1, properties.getInheritableProperties().size());
112:                 assertEquals(VALUE1, properties.getInheritableProperties().get(KEY1));
113:         }
114:
115:         @Test
116:         public void testAddNonInheritablePropertyEmpty() {
117:                 assertNull(properties.addNonInheritableProperty(KEY1, VALUE1));
118:                 assertTrue(properties.getInheritableProperties().isEmpty());
119:                 assertEquals(1, properties.getNonInheritableProperties().size());
120:                 assertEquals(VALUE1, properties.getNonInheritableProperties().get(KEY1));
121:         }
122:
123:         @Test
124:         public void testAddNonInheritablePropertyKeyUsedInInheritable() {
125:                 properties.getInheritableProperties().put(KEY1, VALUE2);
126:                 assertEquals(VALUE2, properties.addNonInheritableProperty(KEY1, VALUE1));
127:                 assertTrue(properties.getInheritableProperties().isEmpty());
128:                 assertEquals(1, properties.getNonInheritableProperties().size());
129:                 assertEquals(VALUE1, properties.getNonInheritableProperties().get(KEY1));
130:         }
131:
132:         @Test
133:         public void testAddNonInheritablePropertyKeyUsedInNonInheritable() {
134:                 properties.getNonInheritableProperties().put(KEY1, VALUE2);
135:                 assertEquals(VALUE2, properties.addNonInheritableProperty(KEY1, VALUE1));
136:                 assertTrue(properties.getInheritableProperties().isEmpty());
137:                 assertEquals(1, properties.getNonInheritableProperties().size());
138:                 assertEquals(VALUE1, properties.getNonInheritableProperties().get(KEY1));
139:         }
140:
141: }