Skip to content

Package: TestValidator

TestValidator

nameinstructionbranchcomplexitylinemethod
TestValidator()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
getEPackage()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getResourceLocator()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
static {...}
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%
validate(int, Object, DiagnosticChain, Map)
M: 9 C: 16
64%
M: 2 C: 2
50%
M: 2 C: 2
50%
M: 2 C: 3
60%
M: 0 C: 1
100%
validateBook(Book, DiagnosticChain, Map)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
validateLibrary(Library, DiagnosticChain, Map)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
validateWriter(Writer, DiagnosticChain, Map)
M: 18 C: 94
84%
M: 25 C: 9
26%
M: 17 C: 1
6%
M: 1 C: 19
95%
M: 0 C: 1
100%
validateWriter_validate(Writer, DiagnosticChain, Map)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2013 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: * Eugen Neufeld - initial API and implementation
13: * Johannes Faltermeier
14: *
15: *******************************************************************************/
16: package org.eclipse.emf.ecp.validation.test.test.util;
17:
18: import java.util.Map;
19:
20: import org.eclipse.emf.common.util.DiagnosticChain;
21: import org.eclipse.emf.common.util.ResourceLocator;
22: import org.eclipse.emf.ecore.EPackage;
23: import org.eclipse.emf.ecore.util.EObjectValidator;
24: import org.eclipse.emf.ecp.validation.test.test.Book;
25: import org.eclipse.emf.ecp.validation.test.test.Library;
26: import org.eclipse.emf.ecp.validation.test.test.TestPackage;
27: import org.eclipse.emf.ecp.validation.test.test.Writer;
28:
29: /**
30: * <!-- begin-user-doc -->
31: * The <b>Validator</b> for the model.
32: * <!-- end-user-doc -->
33: *
34: * @see org.eclipse.emf.ecp.validation.test.test.TestPackage
35: * @generated
36: */
37: public class TestValidator extends EObjectValidator {
38:         /**
39:          * The cached model package
40:          * <!-- begin-user-doc -->
41:          * <!-- end-user-doc -->
42:          *
43:          * @generated
44:          */
45:         public static final TestValidator INSTANCE = new TestValidator();
46:
47:         /**
48:          * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic
49:          * {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package.
50:          * <!-- begin-user-doc -->
51:          * <!-- end-user-doc -->
52:          *
53:          * @see org.eclipse.emf.common.util.Diagnostic#getSource()
54:          * @see org.eclipse.emf.common.util.Diagnostic#getCode()
55:          * @generated
56:          */
57:         public static final String DIAGNOSTIC_SOURCE = "org.eclipse.emf.ecp.validation.test.test";
58:
59:         /**
60:          * The {@link org.eclipse.emf.common.util.Diagnostic#getCode() code} for constraint 'Validate' of 'Writer'.
61:          * <!-- begin-user-doc -->
62:          * <!-- end-user-doc -->
63:          *
64:          * @generated
65:          */
66:         public static final int WRITER__VALIDATE = 1;
67:
68:         /**
69:          * A constant with a fixed name that can be used as the base value for additional hand written constants.
70:          * <!-- begin-user-doc -->
71:          * <!-- end-user-doc -->
72:          *
73:          * @generated
74:          */
75:         private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 1;
76:
77:         /**
78:          * A constant with a fixed name that can be used as the base value for additional hand written constants in a
79:          * derived class.
80:          * <!-- begin-user-doc -->
81:          * <!-- end-user-doc -->
82:          *
83:          * @generated
84:          */
85:         protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT;
86:
87:         /**
88:          * Creates an instance of the switch.
89:          * <!-- begin-user-doc -->
90:          * <!-- end-user-doc -->
91:          *
92:          * @generated
93:          */
94:         public TestValidator() {
95:                 super();
96:         }
97:
98:         /**
99:          * Returns the package of this validator switch.
100:          * <!-- begin-user-doc -->
101:          * <!-- end-user-doc -->
102:          *
103:          * @generated
104:          */
105:         @Override
106:         protected EPackage getEPackage() {
107:                 return TestPackage.eINSTANCE;
108:         }
109:
110:         /**
111:          * Calls <code>validateXXX</code> for the corresponding classifier of the model.
112:          * <!-- begin-user-doc -->
113:          * <!-- end-user-doc -->
114:          *
115:          * @generated
116:          */
117:         @Override
118:         protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics,
119:                 Map<Object, Object> context) {
120:•                switch (classifierID) {
121:                 case TestPackage.LIBRARY:
122:                         return validateLibrary((Library) value, diagnostics, context);
123:                 case TestPackage.WRITER:
124:                         return validateWriter((Writer) value, diagnostics, context);
125:                 case TestPackage.BOOK:
126:                         return validateBook((Book) value, diagnostics, context);
127:                 default:
128:                         return true;
129:                 }
130:         }
131:
132:         /**
133:          * <!-- begin-user-doc -->
134:          * <!-- end-user-doc -->
135:          *
136:          * @generated
137:          */
138:         public boolean validateLibrary(Library library, DiagnosticChain diagnostics, Map<Object, Object> context) {
139:                 return validate_EveryDefaultConstraint(library, diagnostics, context);
140:         }
141:
142:         /**
143:          * <!-- begin-user-doc -->
144:          * <!-- end-user-doc -->
145:          *
146:          * @generated
147:          */
148:         public boolean validateWriter(Writer writer, DiagnosticChain diagnostics, Map<Object, Object> context) {
149:•                if (!validate_NoCircularContainment(writer, diagnostics, context)) {
150:                         return false;
151:                 }
152:                 boolean result = validate_EveryMultiplicityConforms(writer, diagnostics, context);
153:•                if (result || diagnostics != null) {
154:                         result &= validate_EveryDataValueConforms(writer, diagnostics, context);
155:                 }
156:•                if (result || diagnostics != null) {
157:                         result &= validate_EveryReferenceIsContained(writer, diagnostics, context);
158:                 }
159:•                if (result || diagnostics != null) {
160:                         result &= validate_EveryBidirectionalReferenceIsPaired(writer, diagnostics, context);
161:                 }
162:•                if (result || diagnostics != null) {
163:                         result &= validate_EveryProxyResolves(writer, diagnostics, context);
164:                 }
165:•                if (result || diagnostics != null) {
166:                         result &= validate_UniqueID(writer, diagnostics, context);
167:                 }
168:•                if (result || diagnostics != null) {
169:                         result &= validate_EveryKeyUnique(writer, diagnostics, context);
170:                 }
171:•                if (result || diagnostics != null) {
172:                         result &= validate_EveryMapEntryUnique(writer, diagnostics, context);
173:                 }
174:•                if (result || diagnostics != null) {
175:                         result &= validateWriter_validate(writer, diagnostics, context);
176:                 }
177:                 return result;
178:         }
179:
180:         /**
181:          * Validates the validate constraint of '<em>Writer</em>'.
182:          * <!-- begin-user-doc -->
183:          * <!-- end-user-doc -->
184:          *
185:          * @generated
186:          */
187:         public boolean validateWriter_validate(Writer writer, DiagnosticChain diagnostics, Map<Object, Object> context) {
188:                 return writer.validate(diagnostics, context);
189:         }
190:
191:         /**
192:          * <!-- begin-user-doc -->
193:          * <!-- end-user-doc -->
194:          *
195:          * @generated
196:          */
197:         public boolean validateBook(Book book, DiagnosticChain diagnostics, Map<Object, Object> context) {
198:                 return validate_EveryDefaultConstraint(book, diagnostics, context);
199:         }
200:
201:         /**
202:          * Returns the resource locator that will be used to fetch messages for this validator's diagnostics.
203:          * <!-- begin-user-doc -->
204:          * <!-- end-user-doc -->
205:          *
206:          * @generated
207:          */
208:         @Override
209:         public ResourceLocator getResourceLocator() {
210:                 // TODO
211:                 // Specialize this to return a resource locator for messages specific to this validator.
212:                 // Ensure that you remove @generated or mark it @generated NOT
213:                 return super.getResourceLocator();
214:         }
215:
216: } // TestValidator