18
18
19
19
import jakarta .enterprise .inject .Instance ;
20
20
import jakarta .inject .Inject ;
21
- import jakarta .nosql .tck .entities .Person ;
22
21
import net .datafaker .Faker ;
23
22
import org .eclipse .jnosql .communication .semistructured .CommunicationEntity ;
24
23
import org .eclipse .jnosql .communication .semistructured .Element ;
38
37
39
38
import java .util .Collections ;
40
39
import java .util .Map ;
40
+ import java .util .UUID ;
41
41
import java .util .function .Supplier ;
42
42
import java .util .stream .Stream ;
43
43
@@ -84,13 +84,13 @@ void setUp() {
84
84
85
85
@ Test
86
86
void shouldCypher () {
87
- String cypher = "MATCH (n:Person ) RETURN n" ;
87
+ String cypher = "MATCH (n:Music ) RETURN n" ;
88
88
Map <String , Object > parameters = Collections .emptyMap ();
89
- CommunicationEntity entity = CommunicationEntity .of ("Person " );
89
+ CommunicationEntity entity = CommunicationEntity .of ("Music " );
90
90
entity .add (Element .of ("name" , "Ada" ));
91
91
when (manager .executeQuery (cypher , parameters )).thenReturn (Stream .of (entity ));
92
92
93
- Stream <Person > result = template .cypher (cypher , parameters );
93
+ Stream <Music > result = template .cypher (cypher , parameters );
94
94
assertNotNull (result );
95
95
assertTrue (result .findFirst ().isPresent ());
96
96
}
@@ -104,15 +104,15 @@ void shouldThrowExceptionWhenQueryIsNull() {
104
104
@ Test
105
105
void shouldCreateEdge () {
106
106
var faker = new Faker ();
107
- Person source = Person . of ( faker );
108
- Person target = Person . of ( faker );
107
+ Music source = new Music ( UUID . randomUUID (). toString (), faker . funnyName (). name (), 10 );
108
+ Music target = new Music ( UUID . randomUUID (). toString (), faker . funnyName (). name (), 15 );
109
109
String relationshipType = "FRIENDS" ;
110
- Edge <Person , Person > edge = Edge .of (source , relationshipType , target );
110
+ Edge <Music , Music > edge = Edge .of (source , relationshipType , target );
111
111
112
112
113
113
Mockito .when (manager .insert (Mockito .any (CommunicationEntity .class ))).thenAnswer (invocation -> invocation .getArgument (0 ));
114
114
115
- Edge <Person , Person > result = template .edge (source , relationshipType , target );
115
+ Edge <Music , Music > result = template .edge (source , relationshipType , target );
116
116
117
117
assertNotNull (result );
118
118
assertEquals (edge , result );
@@ -122,8 +122,8 @@ void shouldCreateEdge() {
122
122
@ Test
123
123
void shouldThrowExceptionWhenCreatingEdgeWithNullValues () {
124
124
var faker = new Faker ();
125
- Person source = Person . of ( faker );
126
- Person target = Person . of ( faker );
125
+ Music source = new Music ( UUID . randomUUID (). toString (), faker . funnyName (). name (), 10 );
126
+ Music target = new Music ( UUID . randomUUID (). toString (), faker . funnyName (). name (), 15 );
127
127
assertThrows (NullPointerException .class , () -> template .edge (null , "FRIENDS" , target ));
128
128
assertThrows (NullPointerException .class , () -> template .edge (source , (Supplier <String >) null , target ));
129
129
assertThrows (NullPointerException .class , () -> template .edge (source , "FRIENDS" , null ));
@@ -132,8 +132,8 @@ void shouldThrowExceptionWhenCreatingEdgeWithNullValues() {
132
132
@ Test
133
133
void shouldRemoveEdge () {
134
134
var faker = new Faker ();
135
- Person source = Person . of ( faker );
136
- Person target = Person . of ( faker );
135
+ Music source = new Music ( UUID . randomUUID (). toString (), faker . funnyName (). name (), 10 );
136
+ Music target = new Music ( UUID . randomUUID (). toString (), faker . funnyName (). name (), 15 );
137
137
String relationshipType = "FRIENDS" ;
138
138
139
139
doNothing ().when (manager ).remove (any (), anyString (), any ());
@@ -145,8 +145,8 @@ void shouldRemoveEdge() {
145
145
@ Test
146
146
void shouldThrowExceptionWhenRemovingEdgeWithNullValues () {
147
147
var faker = new Faker ();
148
- Person source = Person . of ( faker );
149
- Person target = Person . of ( faker );
148
+ Music source = new Music ( UUID . randomUUID (). toString (), faker . funnyName (). name (), 10 );
149
+ Music target = new Music ( UUID . randomUUID (). toString (), faker . funnyName (). name (), 15 );
150
150
assertThrows (NullPointerException .class , () -> template .remove (null , "FRIENDS" , target ));
151
151
assertThrows (NullPointerException .class , () -> template .remove (source , (String ) null , target ));
152
152
assertThrows (NullPointerException .class , () -> template .remove (source , "FRIENDS" , null ));
0 commit comments