Skip to content

Package: ConditionEvaluator_PTest

ConditionEvaluator_PTest

nameinstructionbranchcomplexitylinemethod
ConditionEvaluator_PTest()
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%
getDate(String)
M: 5 C: 6
55%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 3 C: 1
25%
M: 0 C: 1
100%
setUp()
M: 0 C: 1
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
setupLeafCondition(EStructuralFeature, Object, EObject)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
setupLeafCondition(EStructuralFeature, Object, EObject, List)
M: 0 C: 22
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 8
100%
M: 0 C: 1
100%
setupLeafConditionWithValueDMR(EObject, Object, EReference, List, EAttribute, List)
M: 0 C: 36
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 13
100%
M: 0 C: 1
100%
setupLeague()
M: 0 C: 27
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 8
100%
M: 0 C: 1
100%
setupPlayerRight()
M: 0 C: 36
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 11
100%
M: 0 C: 1
100%
static {...}
M: 3 C: 15
83%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 1 C: 5
83%
M: 0 C: 1
100%
tearDown()
M: 0 C: 1
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
testBigDecimalConditionRight()
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%
testBigDecimalConditionSame()
M: 0 C: 18
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testBigDecimalConditionWrong()
M: 0 C: 18
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testBooleanConditionRight()
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testBooleanConditionWrong()
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testContainmentConditionEObjectDeep()
M: 123 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 27 C: 0
0%
M: 1 C: 0
0%
testContainmentConditionEObjectDeepIndexDMR()
M: 0 C: 144
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 37
100%
M: 0 C: 1
100%
testContainmentConditionEObjectRight()
M: 0 C: 35
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 7
100%
M: 0 C: 1
100%
testContainmentConditionEObjectWrong()
M: 0 C: 19
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
testContainmentConditionStringRight()
M: 0 C: 26
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 8
100%
M: 0 C: 1
100%
testContainmentConditionStringWrong()
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%
testDateConditionRight()
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%
testDateConditionSame()
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testDateConditionWrong()
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testDoubleConditionRight()
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testDoubleConditionWrong()
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testEnumConditionRight()
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testEnumConditionWrong()
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testIntConditionRight()
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testIntConditionWrong()
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
testStringConditionNullRight()
M: 0 C: 18
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
testStringConditionRight()
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%
testStringConditionWrong()
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-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: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.rule.test;
15:
16: import static org.junit.Assert.assertFalse;
17: import static org.junit.Assert.assertTrue;
18:
19: import java.math.BigDecimal;
20: import java.text.DateFormat;
21: import java.text.ParseException;
22: import java.util.Arrays;
23: import java.util.Collections;
24: import java.util.Date;
25: import java.util.List;
26: import java.util.Locale;
27:
28: import org.eclipse.emf.ecore.EAttribute;
29: import org.eclipse.emf.ecore.EObject;
30: import org.eclipse.emf.ecore.EReference;
31: import org.eclipse.emf.ecore.EStructuralFeature;
32: import org.eclipse.emf.ecp.view.spi.indexdmr.model.VIndexDomainModelReference;
33: import org.eclipse.emf.ecp.view.spi.indexdmr.model.VIndexdmrFactory;
34: import org.eclipse.emf.ecp.view.spi.model.VFeaturePathDomainModelReference;
35: import org.eclipse.emf.ecp.view.spi.model.VViewFactory;
36: import org.eclipse.emf.ecp.view.spi.rule.model.LeafCondition;
37: import org.eclipse.emf.ecp.view.spi.rule.model.RuleFactory;
38: import org.eclipse.emf.emfstore.bowling.BowlingFactory;
39: import org.eclipse.emf.emfstore.bowling.BowlingPackage;
40: import org.eclipse.emf.emfstore.bowling.Game;
41: import org.eclipse.emf.emfstore.bowling.Gender;
42: import org.eclipse.emf.emfstore.bowling.League;
43: import org.eclipse.emf.emfstore.bowling.Matchup;
44: import org.eclipse.emf.emfstore.bowling.Player;
45: import org.eclipse.emf.emfstore.bowling.Tournament;
46: import org.junit.After;
47: import org.junit.Before;
48: import org.junit.Ignore;
49: import org.junit.Test;
50:
51: /**
52: * @author Eugen Neufeld
53: *
54: */
55: public class ConditionEvaluator_PTest {
56:
57:         /**
58:          * @throws java.lang.Exception
59:          */
60:         @Before
61:         public void setUp() throws Exception {
62:         }
63:
64:         /**
65:          * @throws java.lang.Exception
66:          */
67:         @After
68:         public void tearDown() throws Exception {
69:         }
70:
71:         private static final String CORRECT_PLAYER_NAME = "player";
72:         private static final Gender CORRECT_PLAYER_GENDER = Gender.FEMALE;
73:         private static Date correctPlayerBirthDate;
74:
75:         private static final int CORRECT_PLAYER_VICTORIES = 42;
76:         private static final double CORRECT_PLAYER_HEIGHT = 42.42;
77:         private static final boolean CORRECT_PLAYER_PROFESSIONAL = false;
78:         private static final BigDecimal CORRECT_PLAYER_RATION = new BigDecimal(42);
79:
80:         private static final String CORRECT_PLAYER_EMAIL1 = "asdf@asdf.com";
81:         private static final String CORRECT_PLAYER_EMAIL2 = "player@asdf.com";
82:
83:         static {
84:                 try {
85:                         correctPlayerBirthDate = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMANY).parse("11.11.2011");
86:                 } catch (final ParseException ex) {
87:                         ex.printStackTrace();
88:                 }
89:         }
90:
91:         private static Date getDate(String value) {
92:                 try {
93:                         return DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMANY).parse(value);
94:                 } catch (final ParseException ex) {
95:                         ex.printStackTrace();
96:                 }
97:                 return null;
98:         }
99:
100:         private Player setupPlayerRight() {
101:                 final Player player = BowlingFactory.eINSTANCE.createPlayer();
102:                 player.setName(CORRECT_PLAYER_NAME);
103:                 player.setGender(CORRECT_PLAYER_GENDER);
104:                 player.setNumberOfVictories(CORRECT_PLAYER_VICTORIES);
105:                 player.setDateOfBirth(correctPlayerBirthDate);
106:                 player.setHeight(CORRECT_PLAYER_HEIGHT);
107:                 player.setIsProfessional(CORRECT_PLAYER_PROFESSIONAL);
108:                 player.setWinLossRatio(CORRECT_PLAYER_RATION);
109:                 player.getEMails().add(CORRECT_PLAYER_EMAIL1);
110:                 player.getEMails().add(CORRECT_PLAYER_EMAIL2);
111:                 return player;
112:         }
113:
114:         private League setupLeague() {
115:                 final League league = BowlingFactory.eINSTANCE.createLeague();
116:                 final Player p1 = BowlingFactory.eINSTANCE.createPlayer();
117:                 p1.setName(CORRECT_PLAYER_NAME + "1");
118:                 final Player p2 = BowlingFactory.eINSTANCE.createPlayer();
119:                 p2.setName(CORRECT_PLAYER_NAME + "2");
120:                 league.getPlayers().add(p1);
121:                 league.getPlayers().add(p2);
122:                 return league;
123:         }
124:
125:         private LeafCondition setupLeafCondition(EStructuralFeature domainFeature, Object expectedValue,
126:                 EObject resolveObject) {
127:                 // final LeafCondition leafCondition = RuleFactory.eINSTANCE.createLeafCondition();
128:                 // final VFeaturePathDomainModelReference modelReference = ViewFactory.eINSTANCE
129:                 // .createVFeaturePathDomainModelReference();
130:                 // modelReference.setDomainModelEFeature(domainFeature);
131:                 // leafCondition.setDomainModelReference(modelReference);
132:                 // leafCondition.setExpectedValue(expectedValue);
133:                 // modelReference.resolve(resolveObject);
134:                 // return leafCondition;
135:                 final List<EReference> references = Collections.emptyList();
136:                 return setupLeafCondition(domainFeature, expectedValue, resolveObject, references);
137:         }
138:
139:         private LeafCondition setupLeafCondition(EStructuralFeature domainFeature, Object expectedValue,
140:                 EObject resolveObject, List<EReference> eReferences) {
141:                 final LeafCondition leafCondition = RuleFactory.eINSTANCE.createLeafCondition();
142:                 final VFeaturePathDomainModelReference modelReference = VViewFactory.eINSTANCE
143:                         .createFeaturePathDomainModelReference();
144:                 modelReference.setDomainModelEFeature(domainFeature);
145:                 leafCondition.setDomainModelReference(modelReference);
146:                 leafCondition.setExpectedValue(expectedValue);
147:                 modelReference.getDomainModelEReferencePath().addAll(eReferences);
148:                 return leafCondition;
149:         }
150:
151:         private LeafCondition setupLeafConditionWithValueDMR(EObject domain, Object expectedValue, EReference domainRef,
152:                 List<EReference> domainPath, EAttribute valueAtt, List<EReference> valuePath) {
153:                 final LeafCondition leafCondition = RuleFactory.eINSTANCE.createLeafCondition();
154:                 leafCondition.setExpectedValue(expectedValue);
155:
156:                 final VFeaturePathDomainModelReference modelDMR = VViewFactory.eINSTANCE
157:                         .createFeaturePathDomainModelReference();
158:                 modelDMR.getDomainModelEReferencePath().addAll(domainPath);
159:                 modelDMR.setDomainModelEFeature(domainRef);
160:                 leafCondition.setDomainModelReference(modelDMR);
161:
162:                 final VFeaturePathDomainModelReference valueDMR = VViewFactory.eINSTANCE
163:                         .createFeaturePathDomainModelReference();
164:                 valueDMR.getDomainModelEReferencePath().addAll(valuePath);
165:                 valueDMR.setDomainModelEFeature(valueAtt);
166:                 leafCondition.setValueDomainModelReference(valueDMR);
167:
168:                 return leafCondition;
169:         }
170:
171:         @Test
172:         public void testBooleanConditionRight() {
173:                 final Player player = setupPlayerRight();
174:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_IsProfessional(),
175:                         CORRECT_PLAYER_PROFESSIONAL, player);
176:
177:                 assertTrue(leafCondition.evaluate(player));
178:         }
179:
180:         @Test
181:         public void testBooleanConditionWrong() {
182:                 final Player player = setupPlayerRight();
183:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_IsProfessional(),
184:                         !CORRECT_PLAYER_PROFESSIONAL, player);
185:
186:                 assertFalse(leafCondition.evaluate(player));
187:         }
188:
189:         @Test
190:         public void testStringConditionNullRight() {
191:                 final Player player = setupPlayerRight();
192:                 player.setName(null);
193:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_Name(),
194:                         null, player);
195:
196:                 assertTrue(leafCondition.evaluate(player));
197:         }
198:
199:         @Test
200:         public void testStringConditionRight() {
201:                 final Player player = setupPlayerRight();
202:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_Name(),
203:                         CORRECT_PLAYER_NAME, player);
204:
205:                 assertTrue(leafCondition.evaluate(player));
206:         }
207:
208:         @Test
209:         public void testStringConditionWrong() {
210:                 final Player player = setupPlayerRight();
211:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_Name(),
212:                         CORRECT_PLAYER_NAME + "BLA", player);
213:
214:                 assertFalse(leafCondition.evaluate(player));
215:         }
216:
217:         @Test
218:         public void testIntConditionRight() {
219:                 final Player player = setupPlayerRight();
220:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_NumberOfVictories(),
221:                         CORRECT_PLAYER_VICTORIES, player);
222:
223:                 assertTrue(leafCondition.evaluate(player));
224:         }
225:
226:         @Test
227:         public void testIntConditionWrong() {
228:                 final Player player = setupPlayerRight();
229:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_NumberOfVictories(),
230:                         CORRECT_PLAYER_VICTORIES + 1, player);
231:
232:                 assertFalse(leafCondition.evaluate(player));
233:         }
234:
235:         @Test
236:         public void testDoubleConditionRight() {
237:                 final Player player = setupPlayerRight();
238:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_Height(),
239:                         CORRECT_PLAYER_HEIGHT, player);
240:
241:                 assertTrue(leafCondition.evaluate(player));
242:         }
243:
244:         @Test
245:         public void testDoubleConditionWrong() {
246:                 final Player player = setupPlayerRight();
247:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_Height(),
248:                         CORRECT_PLAYER_HEIGHT + 1, player);
249:
250:                 assertFalse(leafCondition.evaluate(player));
251:         }
252:
253:         @Test
254:         public void testDateConditionRight() {
255:                 final Player player = setupPlayerRight();
256:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_DateOfBirth(),
257:                         correctPlayerBirthDate, player);
258:
259:                 assertTrue(leafCondition.evaluate(player));
260:         }
261:
262:         @Test
263:         public void testDateConditionWrong() {
264:                 final Player player = setupPlayerRight();
265:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_DateOfBirth(),
266:                         getDate("12.12.2012"), player);
267:
268:                 assertFalse(leafCondition.evaluate(player));
269:         }
270:
271:         @Test
272:         public void testDateConditionSame() {
273:                 final Player player = setupPlayerRight();
274:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_DateOfBirth(),
275:                         getDate("11.11.2011"), player);
276:
277:                 assertTrue(leafCondition.evaluate(player));
278:         }
279:
280:         @Test
281:         public void testEnumConditionRight() {
282:                 final Player player = setupPlayerRight();
283:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_Gender(),
284:                         CORRECT_PLAYER_GENDER.getLiteral(), player);
285:
286:                 assertTrue(leafCondition.evaluate(player));
287:         }
288:
289:         @Test
290:         public void testEnumConditionWrong() {
291:                 final Player player = setupPlayerRight();
292:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_Gender(),
293:                         Gender.MALE.getLiteral(), player);
294:
295:                 assertFalse(leafCondition.evaluate(player));
296:         }
297:
298:         @Test
299:         public void testBigDecimalConditionRight() {
300:                 final Player player = setupPlayerRight();
301:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_WinLossRatio(),
302:                         CORRECT_PLAYER_RATION, player);
303:
304:                 assertTrue(leafCondition.evaluate(player));
305:         }
306:
307:         @Test
308:         public void testBigDecimalConditionSame() {
309:                 final Player player = setupPlayerRight();
310:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_WinLossRatio(),
311:                         new BigDecimal(42), player);
312:
313:                 assertTrue(leafCondition.evaluate(player));
314:         }
315:
316:         @Test
317:         public void testBigDecimalConditionWrong() {
318:                 final Player player = setupPlayerRight();
319:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_WinLossRatio(),
320:                         new BigDecimal(1), player);
321:
322:                 assertFalse(leafCondition.evaluate(player));
323:         }
324:
325:         @Test
326:         public void testContainmentConditionStringRight() {
327:                 final Player player = setupPlayerRight();
328:                 final LeafCondition leafCondition1 = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_EMails(),
329:                         CORRECT_PLAYER_EMAIL1, player);
330:
331:                 assertTrue(leafCondition1.evaluate(player));
332:
333:                 final LeafCondition leafCondition2 = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_EMails(),
334:                         CORRECT_PLAYER_EMAIL2, player);
335:
336:                 assertTrue(leafCondition2.evaluate(player));
337:         }
338:
339:         @Test
340:         public void testContainmentConditionStringWrong() {
341:                 final Player player = setupPlayerRight();
342:                 final LeafCondition leafCondition = setupLeafCondition(BowlingPackage.eINSTANCE.getPlayer_EMails(),
343:                         "bla@bla.com", player);
344:
345:                 assertFalse(leafCondition.evaluate(player));
346:         }
347:
348:         @Test
349:         public void testContainmentConditionEObjectRight() {
350:                 final League league = setupLeague();
351:•                for (int i = 1; i <= league.getPlayers().size(); i++) {
352:                         final LeafCondition leafCondition1 = setupLeafConditionWithValueDMR(league, CORRECT_PLAYER_NAME + i++,
353:                                 BowlingPackage.eINSTANCE.getLeague_Players(), Collections.<EReference> emptyList(),
354:                                 BowlingPackage.eINSTANCE.getPlayer_Name(), Collections.<EReference> emptyList());
355:
356:                         assertTrue(leafCondition1.evaluate(league));
357:                 }
358:
359:         }
360:
361:         @Test
362:         public void testContainmentConditionEObjectWrong() {
363:                 final League league = setupLeague();
364:                 final LeafCondition leafCondition1 = setupLeafConditionWithValueDMR(league, CORRECT_PLAYER_NAME,
365:                         BowlingPackage.eINSTANCE.getLeague_Players(), Collections.<EReference> emptyList(),
366:                         BowlingPackage.eINSTANCE.getPlayer_Name(), Collections.<EReference> emptyList());
367:
368:                 assertFalse(leafCondition1.evaluate(league));
369:
370:         }
371:
372:         @Ignore
373:         public void testContainmentConditionEObjectDeep() {
374:                 /*
375:                  * Currently ignore this test case because it relied on some "iterator magic" of the feature path dmr that
376:                  * allowed to have a path with a list in the middle:
377:                  * Like in this test case the dmr's for the leaf condition have the following scope:
378:                  * Tournament -> List<Matchup> -> List<Game> -> List<Frame>
379:                  * <---------------DMR---------------->
380:                  * ...................................<----valueDMR---->
381:                  * This was kind of a hack and does not work with the databinding service.
382:                  */
383:                 final Tournament tournament = BowlingFactory.eINSTANCE.createTournament();
384:                 final Matchup m1 = BowlingFactory.eINSTANCE.createMatchup();
385:                 final Matchup m2 = BowlingFactory.eINSTANCE.createMatchup();
386:                 tournament.getMatchups().add(m1);
387:                 tournament.getMatchups().add(m2);
388:                 final Game g1 = BowlingFactory.eINSTANCE.createGame();
389:                 final Game g2 = BowlingFactory.eINSTANCE.createGame();
390:
391:                 g1.getFrames().add(2);
392:                 g1.getFrames().add(3);
393:                 g2.getFrames().add(5);
394:                 g2.getFrames().add(8);
395:
396:                 m1.getGames().add(g1);
397:                 m1.getGames().add(g2);
398:
399:                 final Game g3 = BowlingFactory.eINSTANCE.createGame();
400:                 final Game g4 = BowlingFactory.eINSTANCE.createGame();
401:
402:                 g3.getFrames().add(13);
403:                 g3.getFrames().add(21);
404:                 g4.getFrames().add(34);
405:                 g4.getFrames().add(55);
406:
407:                 m2.getGames().add(g3);
408:                 m2.getGames().add(g4);
409:
410:                 final LeafCondition leafCondition1 = setupLeafConditionWithValueDMR(tournament, 21,
411:                         BowlingPackage.eINSTANCE.getMatchup_Games(),
412:                         Arrays.asList(BowlingPackage.eINSTANCE.getTournament_Matchups()),
413:                         BowlingPackage.eINSTANCE.getGame_Frames(), Collections.<EReference> emptyList());
414:
415:                 assertTrue(leafCondition1.evaluate(tournament));
416:
417:         }
418:
419:         @Test
420:         public void testContainmentConditionEObjectDeepIndexDMR() {
421:                 final Tournament tournament = BowlingFactory.eINSTANCE.createTournament();
422:                 final Matchup m1 = BowlingFactory.eINSTANCE.createMatchup();
423:                 final Matchup m2 = BowlingFactory.eINSTANCE.createMatchup();
424:                 tournament.getMatchups().add(m1);
425:                 tournament.getMatchups().add(m2);
426:                 final Game g1 = BowlingFactory.eINSTANCE.createGame();
427:                 final Game g2 = BowlingFactory.eINSTANCE.createGame();
428:
429:                 g1.getFrames().add(2);
430:                 g1.getFrames().add(3);
431:                 g2.getFrames().add(5);
432:                 g2.getFrames().add(8);
433:
434:                 m1.getGames().add(g1);
435:                 m1.getGames().add(g2);
436:
437:                 final Game g3 = BowlingFactory.eINSTANCE.createGame();
438:                 final Game g4 = BowlingFactory.eINSTANCE.createGame();
439:
440:                 g3.getFrames().add(13);
441:                 g3.getFrames().add(21);
442:                 g4.getFrames().add(34);
443:                 g4.getFrames().add(55);
444:
445:                 m2.getGames().add(g3);
446:                 m2.getGames().add(g4);
447:
448:                 final VIndexDomainModelReference indexDMR = VIndexdmrFactory.eINSTANCE.createIndexDomainModelReference();
449:                 indexDMR.setDomainModelEFeature(BowlingPackage.eINSTANCE.getTournament_Matchups());
450:                 indexDMR.setIndex(1);
451:                 final VFeaturePathDomainModelReference targetDMR = VViewFactory.eINSTANCE
452:                         .createFeaturePathDomainModelReference();
453:                 targetDMR.setDomainModelEFeature(BowlingPackage.eINSTANCE.getMatchup_Games());
454:                 indexDMR.setTargetDMR(targetDMR);
455:
456:                 final VFeaturePathDomainModelReference valueDMR = VViewFactory.eINSTANCE
457:                         .createFeaturePathDomainModelReference();
458:                 valueDMR.setDomainModelEFeature(BowlingPackage.eINSTANCE.getGame_Frames());
459:
460:                 final LeafCondition leafCondtion = RuleFactory.eINSTANCE.createLeafCondition();
461:                 leafCondtion.setDomainModelReference(indexDMR);
462:                 leafCondtion.setValueDomainModelReference(valueDMR);
463:                 leafCondtion.setExpectedValue(21);
464:
465:                 assertTrue(leafCondtion.evaluate(tournament));
466:         }
467: }