@@ -32,7 +32,7 @@ public class CypherShellIntegrationTest {
3232 private Logger logger = mock (Logger .class );
3333 private Command rollbackCommand ;
3434 private Command commitCommand ;
35- private Command beginCommand ;
35+ private Command beginCommand ;
3636 private CypherShell shell ;
3737
3838 @ Before
@@ -49,7 +49,7 @@ public void setUp() throws Exception {
4949
5050 @ After
5151 public void tearDown () throws Exception {
52- shell .execute ("MATCH (n:TestPerson ) DETACH DELETE (n)" );
52+ shell .execute ("MATCH (n) DETACH DELETE (n)" );
5353 }
5454
5555 @ Test
@@ -100,7 +100,43 @@ public void rollbackScenario() throws CommandException {
100100 rollbackCommand .execute ("" );
101101
102102 //then
103- shell .execute ("MATCH (n:TestPerson) RETURN n" );
103+ shell .execute ("MATCH (n) RETURN n" );
104+
105+ ArgumentCaptor <String > captor = ArgumentCaptor .forClass (String .class );
106+ verify (logger , times (3 )).printOut (captor .capture ());
107+
108+ List <String > result = captor .getAllValues ();
109+ assertThat (result .get (2 ), is ("n\n (:TestPerson {name: \" Jane Smith\" })" ));
110+ }
111+
112+ @ Test
113+ public void resetOutOfTxScenario () throws CommandException {
114+ //when
115+ shell .execute ("CREATE (:TestPerson {name: \" Jane Smith\" })" );
116+ shell .reset ();
117+
118+ //then
119+ shell .execute ("CREATE (:TestPerson {name: \" Jane Smith\" })" );
120+ shell .execute ("MATCH (n) RETURN n" );
121+
122+ ArgumentCaptor <String > captor = ArgumentCaptor .forClass (String .class );
123+ verify (logger , times (3 )).printOut (captor .capture ());
124+
125+ List <String > result = captor .getAllValues ();
126+ assertThat (result .get (2 ), is ("n\n (:TestPerson {name: \" Jane Smith\" })" +
127+ "\n (:TestPerson {name: \" Jane Smith\" })" ));
128+ }
129+
130+ @ Test
131+ public void resetInTxScenario () throws CommandException {
132+ //when
133+ beginCommand .execute ("" );
134+ shell .execute ("CREATE (:Random)" );
135+ shell .reset ();
136+
137+ //then
138+ shell .execute ("CREATE (:TestPerson {name: \" Jane Smith\" })" );
139+ shell .execute ("MATCH (n) RETURN n" );
104140
105141 ArgumentCaptor <String > captor = ArgumentCaptor .forClass (String .class );
106142 verify (logger , times (3 )).printOut (captor .capture ());
@@ -116,7 +152,7 @@ public void commitScenario() throws CommandException {
116152 commitCommand .execute ("" );
117153
118154 //then
119- shell .execute ("MATCH (n:TestPerson ) RETURN n" );
155+ shell .execute ("MATCH (n) RETURN n" );
120156
121157 ArgumentCaptor <String > captor = ArgumentCaptor .forClass (String .class );
122158 verify (logger , times (2 )).printOut (captor .capture ());
@@ -126,7 +162,7 @@ public void commitScenario() throws CommandException {
126162 }
127163
128164 @ Test
129- public void setUnsetVariables () throws CommandException {
165+ public void setAndListVariables () throws CommandException {
130166 assertTrue (shell .getAll ().isEmpty ());
131167
132168 long randomLong = System .currentTimeMillis ();
0 commit comments