Skip to content

Package: GenderValidator1

GenderValidator1

nameinstructionbranchcomplexitylinemethod
GenderValidator1()
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(EDataType, Object, DiagnosticChain, Map)
M: 0 C: 23
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
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.EClassifier;
23: import org.eclipse.emf.ecore.EDataType;
24: import org.eclipse.emf.ecp.diagnostician.ECPValidator;
25: import org.eclipse.emf.emfstore.bowling.BowlingPackage;
26:
27: /**
28: * @author jfaltermeier
29: *
30: */
31: public class GenderValidator1 extends ECPValidator {
32:
33:         private int hitCount;
34:
35:         /**
36:          * {@inheritDoc}
37:          *
38:          * @see org.eclipse.emf.ecp.diagnostician.ECPValidator#getValidatedEClassifier()
39:          */
40:         @Override
41:         public Set<EClassifier> getValidatedEClassifier() {
42:                 final Set<EClassifier> classifiers = new LinkedHashSet<EClassifier>();
43:                 classifiers.add(BowlingPackage.eINSTANCE.getGender());
44:                 return classifiers;
45:         }
46:
47:         /**
48:          * {@inheritDoc}
49:          *
50:          * @see org.eclipse.emf.ecp.diagnostician.ECPValidator#validate(org.eclipse.emf.ecore.EDataType, java.lang.Object,
51:          * org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
52:          */
53:         @Override
54:         public boolean validate(EDataType eDataType, Object value, DiagnosticChain diagnostics,
55:                 Map<Object, Object> context) {
56:                 hitCount++;
57:                 diagnostics.add(createDiagnostic(Diagnostic.INFO, "source", 0, "Gender", new Object[] { value }, context));
58:                 return false;
59:         }
60:
61:         public int getHitCount() {
62:                 return hitCount;
63:         }
64:
65: }