Skip to content

Package: VTLabelWidthStylePropertyImpl_Test

VTLabelWidthStylePropertyImpl_Test

nameinstructionbranchcomplexitylinemethod
VTLabelWidthStylePropertyImpl_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%
createLabelWidthStyleProperty(boolean, int)
M: 0 C: 12
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testBothSetDifferent()
M: 0 C: 15
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testBothSetSame()
M: 0 C: 15
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testBothUnset()
M: 0 C: 15
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testMineUnset()
M: 0 C: 15
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testOtherDifferentStyle()
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testOtherNull()
M: 0 C: 13
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testOtherUnset()
M: 0 C: 15
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2017 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.template.style.labelwidth.model.impl;
15:
16: import static org.junit.Assert.assertFalse;
17: import static org.junit.Assert.assertTrue;
18:
19: import org.eclipse.emf.ecp.view.template.model.VTStyleProperty;
20: import org.eclipse.emf.ecp.view.template.style.alignment.model.VTAlignmentFactory;
21: import org.eclipse.emf.ecp.view.template.style.labelwidth.model.VTLabelWidthStyleProperty;
22: import org.eclipse.emf.ecp.view.template.style.labelwidth.model.VTLabelwidthFactory;
23: import org.junit.Test;
24:
25: public class VTLabelWidthStylePropertyImpl_Test {
26:
27:         private static VTLabelWidthStyleProperty createLabelWidthStyleProperty(
28:                 boolean set,
29:                 int width) {
30:                 final VTLabelWidthStyleProperty property = VTLabelwidthFactory.eINSTANCE.createLabelWidthStyleProperty();
31:                 property.setWidth(width);
32:•                if (!set) {
33:                         property.unsetWidth();
34:                 }
35:                 return property;
36:         }
37:
38:         @Test
39:         public void testBothUnset() {
40:                 /* setup */
41:                 final VTLabelWidthStyleProperty mine = createLabelWidthStyleProperty(false, 10);
42:                 final VTLabelWidthStyleProperty other = createLabelWidthStyleProperty(false, 20);
43:
44:                 /* act */
45:                 final boolean equalStyles = mine.equalStyles(other);
46:
47:                 /* assert */
48:                 assertTrue(equalStyles);
49:         }
50:
51:         @Test
52:         public void testMineUnset() {
53:                 /* setup */
54:                 final VTLabelWidthStyleProperty mine = createLabelWidthStyleProperty(false, 10);
55:                 final VTLabelWidthStyleProperty other = createLabelWidthStyleProperty(true, 10);
56:
57:                 /* act */
58:                 final boolean equalStyles = mine.equalStyles(other);
59:
60:                 /* assert */
61:                 assertFalse(equalStyles);
62:         }
63:
64:         @Test
65:         public void testOtherUnset() {
66:                 /* setup */
67:                 final VTLabelWidthStyleProperty mine = createLabelWidthStyleProperty(true, 10);
68:                 final VTLabelWidthStyleProperty other = createLabelWidthStyleProperty(false, 10);
69:
70:                 /* act */
71:                 final boolean equalStyles = mine.equalStyles(other);
72:
73:                 /* assert */
74:                 assertFalse(equalStyles);
75:         }
76:
77:         @Test
78:         public void testOtherNull() {
79:                 /* setup */
80:                 final VTLabelWidthStyleProperty mine = createLabelWidthStyleProperty(true, 10);
81:                 final VTLabelWidthStyleProperty other = null;
82:
83:                 /* act */
84:                 final boolean equalStyles = mine.equalStyles(other);
85:
86:                 /* assert */
87:                 assertFalse(equalStyles);
88:         }
89:
90:         @Test
91:         public void testOtherDifferentStyle() {
92:                 /* setup */
93:                 final VTLabelWidthStyleProperty mine = createLabelWidthStyleProperty(true, 10);
94:                 final VTStyleProperty other = VTAlignmentFactory.eINSTANCE.createAlignmentStyleProperty();
95:
96:                 /* act */
97:                 final boolean equalStyles = mine.equalStyles(other);
98:
99:                 /* assert */
100:                 assertFalse(equalStyles);
101:         }
102:
103:         @Test
104:         public void testBothSetDifferent() {
105:                 /* setup */
106:                 final VTLabelWidthStyleProperty mine = createLabelWidthStyleProperty(true, 10);
107:                 final VTLabelWidthStyleProperty other = createLabelWidthStyleProperty(true, 20);
108:
109:                 /* act */
110:                 final boolean equalStyles = mine.equalStyles(other);
111:
112:                 /* assert */
113:                 assertFalse(equalStyles);
114:         }
115:
116:         @Test
117:         public void testBothSetSame() {
118:                 /* setup */
119:                 final VTLabelWidthStyleProperty mine = createLabelWidthStyleProperty(true, 10);
120:                 final VTLabelWidthStyleProperty other = createLabelWidthStyleProperty(true, 10);
121:
122:                 /* act */
123:                 final boolean equalStyles = mine.equalStyles(other);
124:
125:                 /* assert */
126:                 assertTrue(equalStyles);
127:         }
128:
129: }