1515 */
1616package net .biville .florent .sproccompiler ;
1717
18+ import net .biville .florent .sproccompiler .procedures .valid .Procedures ;
1819import org .junit .Rule ;
1920import org .junit .Test ;
20- import test_classes .working_procedures .Procedures ;
2121
2222import org .neo4j .driver .v1 .Config ;
2323import org .neo4j .driver .v1 .Driver ;
3232public class ProcedureTest
3333{
3434
35- @ Rule
36- public Neo4jRule graphDb = new Neo4jRule ().withProcedure ( Procedures .class );
35+ private static final Class <?> PROCEDURES_CLASS = Procedures .class ;
3736
37+ @ Rule
38+ public Neo4jRule graphDb = new Neo4jRule ().withProcedure ( PROCEDURES_CLASS );
39+ private String procedureNamespace = PROCEDURES_CLASS .getPackage ().getName ();
3840
3941 @ Test
4042 public void calls_simplistic_procedure ()
@@ -43,7 +45,7 @@ public void calls_simplistic_procedure()
4345 Session session = driver .session () )
4446 {
4547
46- StatementResult result = session .run ( "CALL test_classes.working_procedures .theAnswer()" );
48+ StatementResult result = session .run ( "CALL " + procedureNamespace + " .theAnswer()" );
4749
4850 assertThat ( result .single ().get ( "value" ).asLong () ).isEqualTo ( 42L );
4951 }
@@ -56,17 +58,17 @@ public void calls_procedures_with_simple_input_type_returning_void()
5658 Session session = driver .session () )
5759 {
5860
59- session .run ( "CALL test_classes.working_procedures .simpleInput00()" );
60- session .run ( "CALL test_classes.working_procedures .simpleInput01('string')" );
61- session .run ( "CALL test_classes.working_procedures .simpleInput02(42)" );
62- session .run ( "CALL test_classes.working_procedures .simpleInput03(42)" );
63- session .run ( "CALL test_classes.working_procedures .simpleInput04(4.2)" );
64- session .run ( "CALL test_classes.working_procedures .simpleInput05(true)" );
65- session .run ( "CALL test_classes.working_procedures .simpleInput06(false)" );
66- session .run ( "CALL test_classes.working_procedures .simpleInput07({foo:'bar'})" );
67- session .run ( "MATCH (n) CALL test_classes.working_procedures .simpleInput08(n) RETURN n" );
68- session .run ( "MATCH p=(()-[r]->()) CALL test_classes.working_procedures .simpleInput09(p) RETURN p" );
69- session .run ( "MATCH ()-[r]->() CALL test_classes.working_procedures .simpleInput10(r) RETURN r" );
61+ session .run ( "CALL " + procedureNamespace + " .simpleInput00()" );
62+ session .run ( "CALL " + procedureNamespace + " .simpleInput01('string')" );
63+ session .run ( "CALL " + procedureNamespace + " .simpleInput02(42)" );
64+ session .run ( "CALL " + procedureNamespace + " .simpleInput03(42)" );
65+ session .run ( "CALL " + procedureNamespace + " .simpleInput04(4.2)" );
66+ session .run ( "CALL " + procedureNamespace + " .simpleInput05(true)" );
67+ session .run ( "CALL " + procedureNamespace + " .simpleInput06(false)" );
68+ session .run ( "CALL " + procedureNamespace + " .simpleInput07({foo:'bar'})" );
69+ session .run ( "MATCH (n) CALL " + procedureNamespace + " .simpleInput08(n) RETURN n" );
70+ session .run ( "MATCH p=(()-[r]->()) CALL " + procedureNamespace + " .simpleInput09(p) RETURN p" );
71+ session .run ( "MATCH ()-[r]->() CALL " + procedureNamespace + " .simpleInput10(r) RETURN r" );
7072 }
7173 }
7274
@@ -77,21 +79,15 @@ public void calls_procedures_with_simple_input_type_returning_record_with_primit
7779 Session session = driver .session () )
7880 {
7981
80- assertThat ( session .run ( "CALL test_classes.working_procedures.simpleInput11('string')" ).single () )
81- .isNotNull ();
82- assertThat ( session .run ( "CALL test_classes.working_procedures.simpleInput12(42)" ).single () ).isNotNull ();
83- assertThat ( session .run ( "CALL test_classes.working_procedures.simpleInput13(42)" ).single () ).isNotNull ();
84- assertThat ( session .run ( "CALL test_classes.working_procedures.simpleInput14(4.2)" ).single () ).isNotNull ();
85- assertThat ( session .run ( "CALL test_classes.working_procedures.simpleInput15(true)" ).single () )
86- .isNotNull ();
87- assertThat ( session .run ( "CALL test_classes.working_procedures.simpleInput16(false)" ).single () )
88- .isNotNull ();
89- assertThat ( session .run ( "CALL test_classes.working_procedures.simpleInput17({foo:'bar'})" ).single () )
82+ assertThat ( session .run ( "CALL " + procedureNamespace + ".simpleInput11('string')" ).single () ).isNotNull ();
83+ assertThat ( session .run ( "CALL " + procedureNamespace + ".simpleInput12(42)" ).single () ).isNotNull ();
84+ assertThat ( session .run ( "CALL " + procedureNamespace + ".simpleInput13(42)" ).single () ).isNotNull ();
85+ assertThat ( session .run ( "CALL " + procedureNamespace + ".simpleInput14(4.2)" ).single () ).isNotNull ();
86+ assertThat ( session .run ( "CALL " + procedureNamespace + ".simpleInput15(true)" ).single () ).isNotNull ();
87+ assertThat ( session .run ( "CALL " + procedureNamespace + ".simpleInput16(false)" ).single () ).isNotNull ();
88+ assertThat ( session .run ( "CALL " + procedureNamespace + ".simpleInput17({foo:'bar'})" ).single () )
9089 .isNotNull ();
91- // assertThat(session.run("MATCH (n) CALL test_classes.working_procedures.simpleInput18(n) YIELD field01 RETURN *").single()).isNotNull();
92- // assertThat(session.run("MATCH p=(()-[r]->()) CALL test_classes.working_procedures.simpleInput19(p) YIELD field01 RETURN *").single()).isNotNull();
93- // assertThat(session.run("MATCH ()-[r]->() CALL test_classes.working_procedures.simpleInput20(r) YIELD field01 RETURN *").single()).isNotNull();
94- assertThat ( session .run ( "CALL test_classes.working_procedures.simpleInput21()" ).single () ).isNotNull ();
90+ assertThat ( session .run ( "CALL " + procedureNamespace + ".simpleInput21()" ).single () ).isNotNull ();
9591 }
9692
9793 }
0 commit comments