11/*
2+ * Copyright 2021 webtau maintainers
23 * Copyright 2019 TWO SIGMA OPEN SOURCE, LLC
34 *
45 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,15 +26,32 @@ import static org.testingisdocumenting.webtau.data.traceable.CheckLevel.FuzzyPas
2526import static org.testingisdocumenting.webtau.data.traceable.CheckLevel.None
2627
2728class DataNodeListContainHandlerTest {
28- def listOfNames = [
29+ def listOfFirstNames = [' FN0' , ' FN1' , ' FN2' , ' FN3' ]
30+
31+ def listOfFullNames = [
2932 [firstName : ' FN0' , lastName : ' LN0' ],
3033 [firstName : ' FN1' , lastName : ' LN1' ],
3134 [firstName : ' FN2' , lastName : ' LN2' ],
3235 [firstName : ' FN3' , lastName : ' LN3' ]]
3336
37+
38+ @Test
39+ void " should mark single containing items with passed status and not change other item statuses" () {
40+ def dataNode = DataNodeBuilder . fromList(new DataNodeId (' body' ), listOfFirstNames)
41+
42+ dataNode. get(0 ). getTraceableValue(). updateCheckLevel(FuzzyPassed )
43+
44+ dataNode. should contain(' FN2' )
45+
46+ dataNode. get(0 ). getTraceableValue(). checkLevel. should == FuzzyPassed
47+ dataNode. get(1 ). getTraceableValue(). checkLevel. should == None
48+ dataNode. get(2 ). getTraceableValue(). checkLevel. should == ExplicitPassed
49+ dataNode. get(3 ). getTraceableValue(). checkLevel. should == None
50+ }
51+
3452 @Test
3553 void " should mark containing items with passed status and not change other item statuses" () {
36- def dataNode = DataNodeBuilder . fromList(new DataNodeId (" body" ), listOfNames )
54+ def dataNode = DataNodeBuilder . fromList(new DataNodeId (' body' ), listOfFullNames )
3755
3856 dataNode. get(0 ). get(' firstName' ). getTraceableValue(). updateCheckLevel(FuzzyPassed )
3957
@@ -49,9 +67,27 @@ class DataNodeListContainHandlerTest {
4967 dataNode. get(3 ). get(' lastName' ). getTraceableValue(). checkLevel. should == ExplicitPassed
5068 }
5169
70+ @Test
71+ void " should mark containing items with passed status and not change other item statuses when compare derived items" () {
72+ def dataNode = DataNodeBuilder . fromList(new DataNodeId (' body' ), listOfFullNames)
73+
74+ dataNode. get(0 ). get(' firstName' ). getTraceableValue(). updateCheckLevel(FuzzyPassed )
75+
76+ dataNode. get(" firstName" ). should contain(' FN3' )
77+
78+ dataNode. get(0 ). get(' firstName' ). getTraceableValue(). checkLevel. should == FuzzyPassed
79+ dataNode. get(0 ). get(' lastName' ). getTraceableValue(). checkLevel. should == None
80+ dataNode. get(1 ). get(' firstName' ). getTraceableValue(). checkLevel. should == None
81+ dataNode. get(1 ). get(' lastName' ). getTraceableValue(). checkLevel. should == None
82+ dataNode. get(2 ). get(' firstName' ). getTraceableValue(). checkLevel. should == None
83+ dataNode. get(2 ). get(' lastName' ). getTraceableValue(). checkLevel. should == None
84+ dataNode. get(3 ). get(' firstName' ). getTraceableValue(). checkLevel. should == ExplicitPassed
85+ dataNode. get(3 ). get(' lastName' ). getTraceableValue(). checkLevel. should == None
86+ }
87+
5288 @Test
5389 void " should mark all items as failed when item is not present" () {
54- def dataNode = DataNodeBuilder . fromList(new DataNodeId (" body" ), listOfNames )
90+ def dataNode = DataNodeBuilder . fromList(new DataNodeId (' body' ), listOfFullNames )
5591
5692 code {
5793 dataNode. should contain([firstName : ' FN8' , lastName : ' LN8' ])
@@ -63,15 +99,15 @@ class DataNodeListContainHandlerTest {
6399
64100 @Test
65101 void " should mark all items as fuzzy passed when item is not present and should not be present" () {
66- def dataNode = DataNodeBuilder . fromList(new DataNodeId (" body" ), [1 , 2 , 3 ])
102+ def dataNode = DataNodeBuilder . fromList(new DataNodeId (' body' ), [1 , 2 , 3 ])
67103 dataNode. shouldNot contain(8 )
68104
69105 dataNode. elements(). collect { it. getTraceableValue(). checkLevel }. should == [FuzzyPassed , FuzzyPassed , FuzzyPassed ]
70106 }
71107
72108 @Test
73109 void " should mark containing items as failed when when they should not be present" () {
74- def dataNode = DataNodeBuilder . fromList(new DataNodeId (" body" ), listOfNames )
110+ def dataNode = DataNodeBuilder . fromList(new DataNodeId (' body' ), listOfFullNames )
75111
76112 code {
77113 dataNode. shouldNot contain([firstName : ' FN2' , lastName : ' LN2' ])
0 commit comments