Skip to content

Package: PlayerValidatorName

PlayerValidatorName

nameinstructionbranchcomplexitylinemethod
PlayerValidatorName()
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%
getHitCount()
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%
getValidatedEClassifier()
M: 0 C: 11
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
validate(EClass, EObject, DiagnosticChain, Map)
M: 0 C: 28
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2014 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.validation.diagnostician.test;
15:
16: import java.util.LinkedHashSet;
17: import java.util.Map;
18: import java.util.Set;
19:
20: import org.eclipse.emf.common.util.Diagnostic;
21: import org.eclipse.emf.common.util.DiagnosticChain;
22: import org.eclipse.emf.ecore.EClass;
23: import org.eclipse.emf.ecore.EClassifier;
24: import org.eclipse.emf.ecore.EObject;
25: import org.eclipse.emf.ecp.diagnostician.ECPValidator;
26: import org.eclipse.emf.emfstore.bowling.BowlingPackage;
27:
28: /**
29: * @author jfaltermeier
30: *
31: */
32: public class PlayerValidatorName extends ECPValidator {
33:
34:         private int hitCount;
35:
36:         /**
37:          * {@inheritDoc}
38:          *
39:          * @see org.eclipse.emf.ecp.diagnostician.ECPValidator#getValidatedEClassifier()
40:          */
41:         @Override
42:         public Set<EClassifier> getValidatedEClassifier() {
43:                 final Set<EClassifier> classifiers = new LinkedHashSet<EClassifier>();
44:                 classifiers.add(BowlingPackage.eINSTANCE.getPlayer());
45:                 return classifiers;
46:         }
47:
48:         /**
49:          * {@inheritDoc}
50:          *
51:          * @see org.eclipse.emf.ecp.diagnostician.ECPValidator#validate(org.eclipse.emf.ecore.EClass,
52:          * org.eclipse.emf.ecore.EObject, org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
53:          */
54:         @Override
55:         public boolean validate(EClass eClass, EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) {
56:                 hitCount++;
57:                 diagnostics.add(createDiagnostic(Diagnostic.ERROR, "source", 0, "Name", new Object[] { eObject,
58:                         BowlingPackage.eINSTANCE.getPlayer_Name() }, context));
59:                 return false;
60:         }
61:
62:         public int getHitCount() {
63:                 return hitCount;
64:         }
65:
66: }